• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Migration from Hibernate 2 to Hibernate 3.2.2

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Don't destroy the earth! That's where I keep all my stuff! Including this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic