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.  [ 5 posts ] 
Author Message
 Post subject: Flush only some objects
PostPosted: Fri Jan 26, 2007 2:18 pm 
Newbie

Joined: Mon Oct 09, 2006 2:50 pm
Posts: 15
Hello,

I need to Flush only some objects in my ISession. But without to call evict to the other objects. (Because of LazyLoading).

Is this possible?

(Using .NET 2.0 and NHibernate 1.2Beta3)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 26, 2007 3:39 pm 
Contributor
Contributor

Joined: Sat Sep 24, 2005 11:25 am
Posts: 198
Create a new session, with the old session connection (or not, if you are using eager release mode).
Save the objects you want, and flush the new session.
That is the easiest way I can think about.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 26, 2007 3:57 pm 
Newbie

Joined: Mon Oct 09, 2006 2:50 pm
Posts: 15
Jippy! Thank you very much!!!

I even thougt I have to die :-) and there's no way to solve my problem!

But your suggestion helped and all is fine!!! Life is great!

Thx, Thx, Thx!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 29, 2007 7:40 am 
Newbie

Joined: Mon Oct 09, 2006 2:50 pm
Posts: 15
Hi again,

ther's now a new old problem:

When I now create a new session and save theese (existing) objects, I get following Exception:

"Illegal to attempt a collection with two open sessions!"

What's now?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 29, 2007 8:13 am 
Newbie

Joined: Mon Oct 09, 2006 2:50 pm
Posts: 15
Well,

for now I think I found a solution:

I now use ISession.SaveOrUpdateCopy(...) and all is fine...

I think it's ok, because I close the "save-session" immediately after I called SaveOrUpdateCopy, Commit and Flush.


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