-->
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.  [ 4 posts ] 
Author Message
 Post subject: Need help understanding the release_mode option
PostPosted: Mon Nov 14, 2005 3:56 pm 
Newbie

Joined: Mon Nov 14, 2005 3:35 pm
Posts: 3
I want to use hibernate.connection.release_mode in the case of non-JTA connections and I am trying to understand what Hibernate does when release_mode is set to "after_transaction".

The documentation says "For a non-JTA connection, it often makes sense to release the connection at the end of each transaction, by using after_transaction."

Can someone explains how Hibernate figures out that the transaction is completed ? Especially in the case of a query that does not invoke a commit(), how does Hibernate know that it's safe to close the session ?
(I do not use the Transaction object so a query for me looks like this :
List objects = session.createQuery(oqlQuery).list();)

If this is explained in the 3.1 documentation, can someone point me to it, I've only been able to find documentation for 3.0.5.

Thanks.

Laurent


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 14, 2005 7:37 pm 
Beginner
Beginner

Joined: Tue Oct 18, 2005 3:57 pm
Posts: 48
Location: Los Angeles, CA
When you close the session, its db connection is also closed.


Top
 Profile  
 
 Post subject: Need help understanding the release_mode option
PostPosted: Mon Nov 14, 2005 7:50 pm 
Newbie

Joined: Mon Nov 14, 2005 3:35 pm
Posts: 3
I think that what you said applies if you set hibernate.connection.release_mode = "on_close" which is the default value in 3.0.5. The documentation says : "By default, a JDBC connection is held until the session is explicitly closed or disconnected."
That's not what I want. I want to understand what the option after_transaction does.


Top
 Profile  
 
 Post subject: Re: Need help understanding the release_mode option
PostPosted: Tue Nov 15, 2005 4:09 am 
Regular
Regular

Joined: Sat Nov 05, 2005 5:33 am
Posts: 70
Location: Linz, Austria
lplumelle wrote:
I think that what you said applies if you set hibernate.connection.release_mode = "on_close" which is the default value in 3.0.5. The documentation says : "By default, a JDBC connection is held until the session is explicitly closed or disconnected."
That's not what I want. I want to understand what the option after_transaction does.


I guess then you'll have to close the transaction.

You can invoke commit (or rollback, it shouldn't make a difference) after a query to complete the transaction.
Otherwise, it's going to be kept open.

_________________
hth,
Heinz
Don't forget to rate if this helped


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