-->
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: Evict object in session without loosing lazy loading
PostPosted: Fri Feb 29, 2008 8:00 am 
Newbie

Joined: Mon Jul 10, 2006 10:21 am
Posts: 12
Is it possible to allow nhibernate to update only if i call update ( or saveandupdate ) befor flush for an object and not only when i call flush?

We have a large object model where we use lazy loading to prevent long loading times. Know we want to allow the users to discard changes. But every time i update another object, i have to call flush and the all changes for all object inside the session are flushed.

I can not use Evict, because this disable lazy laoding. And i can not user more the one session, but if i set this object to an object from another session i got an error beause the object are already assigned to a session.

Steve


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 29, 2008 8:42 am 
Regular
Regular

Joined: Wed Jan 25, 2006 1:11 am
Posts: 118
Location: Copenhagen, Denmark
Discard changes = rollback the transaction?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 29, 2008 9:16 am 
Newbie

Joined: Mon Jul 10, 2006 10:21 am
Posts: 12
No the we evict the changed object and reload the state from db into a new instance.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 29, 2008 9:32 am 
Regular
Regular

Joined: Wed Jan 25, 2006 1:11 am
Posts: 118
Location: Copenhagen, Denmark
I don't think i understand the problem then. My suggestion (short formulated i admit) is that if the user want to discard changes you rollback a transaction there was started when user started to change things.

If i don't understand you correctly you might look at putting detached objects back into a new session to enable lazy loading. Take a look at: http://intellect.dk/post/Detached-objects-in-nHibernate-and-Lazy-loading.aspx


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.