In a the Spring forum thread
http://forum.springsource.org/showthread.php?t=80015 I described a problem that seems to boil down to the fact that on Unix/Weblogic persistence.xml seems to be loaded by Hibernate before the Spring entity manager config is applied. Is there a sensible explanation for this?
In short...
The Spring config properly configures the transaction manager lookup for Hibernate like so:
Code:
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
...
<property name="jpaPropertyMap">
<map>
<entry key="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
While loading the application on Unix/Weblogic, however, Hibernate complains about:
Code:
org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:361)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
The remedy for that was to set the lookup class redundantly also in persistence.xml:
Code:
<persistence-unit name="cstd" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/myds</jta-data-source>
...
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
Why is that necessary on Unix but not on Windows? Why is it necessary at all?
Cheers,
Marcel