-->
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.  [ 5 posts ] 
Author Message
 Post subject: Question abt Nested transaction in Hibernate 3.1.
PostPosted: Tue Jan 17, 2006 5:28 pm 
Newbie

Joined: Tue Jan 17, 2006 5:12 pm
Posts: 1
I have a quick question about nested transaction in Hibernate version: 3.1.

I have this following code which works without any issues in Hibernate 3.0.

Code:
Session session;
Transaction tx;  //Global variable

void method1(){
   tx = session.beginTransaction();

  method2();
  //Do something
  session.saveOrUpdate(myobj1); 
  tx.commit();          <------- I'm getting error here
}

void method2(){
  tx = session.beginTransaction();

  //Do something
  session.saveOrUpdate(myobj2);
  tx.commit();
}



When I migrated my code to 3.1, I've started getting the below exception.

Code:
Fri Jan 13 18:13:35 EST 2006 ERROR  [main] CriticalException - ERROR : Unable to get Connection object from Session; nested exception   is:
        org.hibernate.TransactionException: Transaction not successfully started
org.hibernate.TransactionException: Transaction not successfully started
        at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:100)
        at com.gs.refs.api.REFSAdminAPIHelper.checkAndBuildKeys(REFSAdminAPIHelper.java:1661)
        at com.gs.refs.api.REFSAdminAPI.checkAndBuildKeys(REFSAdminAPI.java:783)
        at com.gs.aml.rls.helper.REFSScreeningAdminClient.main(REFSScreeningAdminClient.java:133)


Can someone please help me understand why I'm getting this error?

Name and version of the database used: UDB 8


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 17, 2006 7:21 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
You cannot always nest Transactions as in many cases the under lying TX managers don't support them. In this case, the error reporting is stronger.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 2:30 pm 
Newbie

Joined: Thu Sep 22, 2005 7:40 am
Posts: 5
But I am getting the same exception when the underlying implemenatation allows nested transcations (Weblogic, JTA) something has changed between 3.0 and 3.1 as indicated by other threads.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 30, 2006 8:15 pm 
Regular
Regular

Joined: Sat Jan 22, 2005 6:57 pm
Posts: 50
Location: Chicago
I see the same exact problem.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 01, 2006 1:27 am 
Newbie

Joined: Sun Mar 06, 2005 3:18 pm
Posts: 7
+1
I was just about to post this same bug. It's a terrible pain since you cannot always tell if methods from other (potentially 3rd party) objects are opening and closing their own tx.


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

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.