I have a problem running Hibernate 3 on Websphere 5.1. I always get the following error when building the hibernate sessionfactory
Code:
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
org.hibernate.HibernateException: Unable to locate current JTA transaction
My config file looks like follows:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.session_factory_name">HibernateSessionFactory</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.connection.datasource">jdbc/MyDataSource</property>
<property name="hibernate.transaction.factory_class">
org.hibernate.transaction.JTATransactionFactory
</property>
<property name="hibernate.transaction.manager_lookup_class">
org.hibernate.transaction.WebSphereTransactionManagerLookup
</property>
<property name="hibernate.jndi.class">
com.ibm.websphere.naming.WsnInitialContextFactory
</property >
<property name="hibernate.current_session_context_class">jta</property>
<mapping resource="User.hbm.xml" />
</session-factory>
</hibernate-configuration>
Can anyone help me? Thanks!