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: What is the efficient way to protect transaction leaking.
PostPosted: Fri Mar 23, 2007 2:26 pm 
Newbie

Joined: Tue Aug 01, 2006 7:37 pm
Posts: 7
I found some transaction leaking in my application. That is a transaction starts, but not commit or rollback. Some of these cases happened when the application encountered errors or exception that not be caught. Is there any smart way that can protect my transaction not being leaking? Some way that not changes the application code, but my transaction class will be great.

My property setting is following:

<property name="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property>


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 24, 2007 10:54 am 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
Use automatic tx demarcation. Never issue a begin or a commit. The demarcation proxy will commit if the code threw no exception (you can even configure which exceptions should trigger a rollback or a commit anyway.).

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


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.