-->
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.  [ 2 posts ] 
Author Message
 Post subject: Commit and Rollback closes the Session (3.3.1.GA)
PostPosted: Sat Jan 10, 2009 8:53 am 
Newbie

Joined: Tue Aug 16, 2005 9:21 am
Posts: 12
Hi,
Anybody knows why Hibernate 3.3.1.GA is closing the session when you perform a commit or rollback?

Is there any configuration to change it? Is it a new feature or is a bug?
Any help is welcome.

Thx,
Rodrigo Souza
Campinas - SP
Brazil


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 10, 2009 12:33 pm 
Newbie

Joined: Fri Jan 09, 2009 4:31 am
Posts: 9
See Java Persistence with Hibernate 11.1.2.
"All the data-access code that calls getCurrentSession() on the global shared SessionFactory gets access to the same current Session—if it’s called in the
same thread. The unit of work completes when the Transaction is committed (or rolled back). Hibernate also flushes and closes the current Session and its persistence context if you commit or roll back the transaction. The implication here is that a call to getCurrentSession() after commit or rollback produces a new Session and a fresh persistence context".

I think this is good feature. After commit or rollback Session is in inconsistent state and is not usable, because another transaction can change data in db and persistent context stay in old state in next transaction.


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