-->
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: Way to determine if session has started a transaction bound?
PostPosted: Tue Jul 05, 2005 12:16 pm 
Newbie

Joined: Tue Jul 05, 2005 12:02 pm
Posts: 1
The short question: is there a way to determine if a particular session object is already associated with a transaction (i.e. has already called beginTransaction())?

And if you want to know why I need to know ....

I have sort coded myself into a corner by putting a call to getSession() in some old legacy code. Mainly as a convenience to obtain a connection. This of course creates a connection leak since I do not explicitly close it.

Well, now I have to fix it. Problem is this code is called by code within a Hibernate transaction while other older code also calls it that is not within a transaction. So if I explicitly close the session to handle the leak, I will break the code that is running in a transaction since I will invalidate the session by calling close().


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.