Announcement Announcement Module
No announcement yet.
JPA in JEE with Spring Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • JPA in JEE with Spring

    I'm using Spring 3.0.2 with GlassFish 3 (JDK6 / JEE 6)

    I'm using JPA (EclipseLink 2.0) for my persistence provider in addition to the Spring JpaTemplate. I've got my Dao's defined with @Resource and they are auto discovered by Spring via the <context:component-scan> element. Everything seems to work very well together but I'm having a difficult time locating the EntityManager. I'm attempting to deploy the application as an EJB only app, which means I must bundle it within an EAR. But I can't seem to get Spring to locate the EntityManager or more precisely, the PersistenceUnit.

    I've tried the default
    <jndi:lookup id="entitymanager" jndi-name="myPersistenceUnit"/>
    and I've tried
    <bean id="entityManager" class=">
      <property name="persistenceUnits">
          <entry key="myPersistenceUnit" value="persistence/myPersistenceUnit"/>
    But that did not work either. I want to use the EntityManager configured for the application and defined in JNDI rather than a Local instance, but I simply can't seem to get this to work.

    Any help is greatly appreciated.