I switched from Hibernate 4.2 to Hibernate 4.3 and my project is not working any more. I'm getting an
HibernateException: Unable to locate current JTA transaction
when I do
Session s = sessionFactory.getCurrentSession();
I've realized that org.hibernate.transaction.TransactionManagerLookup does not exist any more. It was deleted in Hibernate 4.3. How should I change my current configuration?
<hibernate-configuration>
<session-factory>
<property name="connection.datasource">testDS</property>
<property name="current_session_context_class">jta</property>
<property name="transaction.manager_lookup_class">com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup</property>
<property name="transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
<property name="connection.release_mode">auto</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="hibernate.hbm2ddl.auto">create-drop</property>
<property name="hibernate.show_sql">true</property>
<mapping class="test.entities.Person" />
<mapping class="test.entities.CreditCard" />
<mapping class="test.entities.ExampleRevEntity" />
</session-factory>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…