Hi,
Hibernate2
-------------
Configuration File:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<!-- MERLIN Session factory instance. -->
<session-factory>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.connection.datasource">jdbc/sampleDS</property>
<property name="hibernate.dialect">net.sf.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.jdbc.use_streams_for_binary">true</property>
<property name="hibernate.jdbc.batch_size">0</property>
<property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property>
<property name="jta.UserTransaction">jta/usertransaction</property>
<mapping resource="com/Users.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Session Factory
Java:
SessionFactory sessionFactory = new Configuration().configure("/samplehibernate.cfg.xml").buildSessionFactory();
Session sessionObj=sessionFactory.openSession();
Collection coll=sessionObj.find("from com.Users as users");
Hibernate 3.2.2
-----------------
Configuration File
<!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.connection.datasource">jdbc/sampleDS</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="show_sql">true</property>
<mapping resource="com/Users.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Session Factory Java:
SessionFactory sessionFactory = new Configuration().configure("/samplehibernate.cfg.xml").buildSessionFactory();
Session sessionObj=sessionFactory.openSession();
Collection coll=sessionObj.createQuery("from com.Users as users").list();
I am getting the following exception:
org.hibernate.TransactionException: Unable to locate UserTransaction to check status
at org.hibernate.transaction.JTATransactionFactory.isTransactionInProgress(JTATransactionFactory.java:102)
at org.hibernate.jdbc.JDBCContext.isTransactionInProgress(JDBCContext.java:187)
at org.hibernate.impl.SessionImpl.isTransactionInProgress(SessionImpl.java:369)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:962)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
Any help is appreciated.
Thanks
Sudha