-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Losing db changes HibernateUtil and Weblogic 8.1 cluster
PostPosted: Sat Apr 01, 2006 12:22 am 
Newbie

Joined: Fri Sep 09, 2005 11:40 am
Posts: 12
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.0

I am working with Weblogic 8.1 in a clustered environment. I am using the HibernateUtil class as specified in the Hibernate in Action book. For some reason I can not invoke the HibernateUtil.commitTransaction. When I try I get an Exception thrown stating the Session is closed. The following code however seems to work:

Code:

Session sess = HibernateUtil.getSession();
Transaction tx = sess.getTransaction();

sess.saveOrUpdate(myObject);

tx.commit();
...
HibernateUtil.closeSession();




When the Transaction tx = sess.getTransaction() is replaced with HibernateUtil.beginTransaction and tx.commit() with HibernateUtil.commitTransaction() an Exception is thrown. If I remove the HibernateUtil.commitTransaction call and use sess.flush and then just close the transaction this seems to work but our changes to the database are not always saved. This has become difficult to troubleshoot because the problem is intermittent and we are never really sure now when/if we have fixed the problem. We are planning to go with the code above in the code box since the explicit commit call seems to work. My question is does anyone know if the HibernateUtil class has problems operating in a Weblogc cluster? Would the use of the local thread variables cause a problem?

Michelle


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.