File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Migration from Hibernate 2 to Hibernate 3.2.2 Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "Migration from Hibernate 2 to Hibernate 3.2.2" Watch "Migration from Hibernate 2 to Hibernate 3.2.2" New topic
Author

Migration from Hibernate 2 to Hibernate 3.2.2

sudha swami
Ranch Hand

Joined: Apr 24, 2007
Posts: 177
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Migration from Hibernate 2 to Hibernate 3.2.2
 
Similar Threads
glassfish vs. Hibernate: JNDI configuration
Problem with Hibernate3 on WAS 5.1
org.hibernate.HibernateException: No TransactionManagerLookup specified
NullPointerException on SessionFactory sessionFactory = new Configuration().configure().buildSession
JNDI error message