-->
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: When to use session.clear ?
PostPosted: Thu Aug 13, 2009 4:55 am 
Newbie

Joined: Thu Aug 13, 2009 4:39 am
Posts: 2
Hi,

Hibernate version : 3.2.5.Ga

My context : one hibernate session is opened. Inside this session, there are many managed objects, some have relationships in lazy loading mode (1-N,N-1).
I start a transaction , perfom a save and a flush.
Some business rule triggered by persistence listeners throw an exception : i perform a rollback over the transaction.
My session remains opened.
I want to resave and flush the session again after the user has fixed some datas.
It appears to me that some use cases need the cleaning of hibernate session (mysterious exception) some don't.

Should-i clear the session after a rollback ?

Thanks.


Top
 Profile  
 
 Post subject: Re: When to use session.clear ?
PostPosted: Thu Aug 13, 2009 9:59 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
I'm wondering if you need all of those flushes?

I think you really want to get a new session and begin a new transaction. Is there a major downside to that approach?

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


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.