With Glassfish V1, I could use Spring with a container managed entity manager :
@PersistenceContext(unitName = "PetCatalogPu")
private EntityManager em;
To do this, I had to configure The Entity Manager factory and the transactionManager in the spring applicationContext.xml .
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
..
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
...
this no longer works in Glassfish v2 (I get the same error as Gerald Holl), apparently because spring does not use JTA for this.
I noticed that spring provides a JTA manager for Weblogic and Websphere:
<bean id="transactionManager"
class="org.springframework.transaction.jta.WebLogicJtaTransactionManager">
<property name="transactionManagerName"
value="javax.transaction.TransactionManager"/>
</bean>
Has anyone used Spring 2.x , JPA and Glassfish 2 successfully? Is the solution to only use
Application Managed entity manager?
[Message sent by forum member 'caroljmcdonald' (caroljmcdonald)]
http://forums.java.net/jive/thread.jspa?messageID=252241