-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate - Multiple Transactions
PostPosted: Tue Jun 26, 2007 7:31 pm 
I have multiple threads running, each one is creating a transaction over a single session..


According to the API doc, "it is intended that there be at most one uncommitted Transaction associated with a particular Session at any time"

Is there no way to run concurrent transactions in hibernate over a single session?



I am using Hibernate 3.2


Top
  
 
 Post subject:
PostPosted: Tue Jun 26, 2007 8:17 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
If each thread is getting its own individual session from the sessionfactory then there are no issues. If you have multiple threads accessing the same session instance then this is not thread safe. In general nested transactions are not supported by database vendors. The JTA spec gets around it by suspending a transaction (throught the TransactionManager interface) to allow another Tx to be used. Hibernate can emulate this in JDBC Tx mode.


Top
 Profile  
 
 Post subject: Hibernate - Multiple Transactions
PostPosted: Tue Jun 26, 2007 8:28 pm 
I am confused with the notion of nested transactions... transactions started in multiple threads are supposed to run parallely and individually right?

If i start transaction in multiple threads over a single session, cant i achieve parallelism? will the transactions run sequentially?


Top
  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.