-->
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: How to import an object from one session to antother?
PostPosted: Mon Aug 06, 2007 6:00 am 
Newbie

Joined: Mon Jun 18, 2007 3:48 am
Posts: 7
Location: FRANCE
Hibernate version: 1.2.0.4000GA

Hello, I'm using NHibernate for the first time, and I have the following problem :

I've got 2 sessions opened at the same time and I must pass a persistent object from one session to the other without saving it.

I've tried to find how o make an "import" of my object into the destination session, but I didn't find the way to do it.

Could someone please tell me how to do?

Thank you very much for any answer and sorry for my bad written english.




Laurent MONDEIL.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 06, 2007 9:03 am 
Regular
Regular

Joined: Thu Nov 23, 2006 10:29 am
Posts: 106
Location: Belgium
Hello,

One way to 'bind' a persistent object to a session is Lock().
But the main problem here is: as long as the session that retrieved the object lives, the object cannot be Locked by another session.

I do not think what you want to do is possible (at least, without refreshing or re-getting the object from the datastore).

_________________
Please rate this post if it helped.

X.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 06, 2007 10:01 am 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
You could evict is from session one before locking to session two. Keep in mind though that updates to that object will no longer be tracked for the first session.

Symon.


Top
 Profile  
 
 Post subject: Ok to evict, but then....?
PostPosted: Tue Aug 07, 2007 10:57 am 
Newbie

Joined: Mon Jun 18, 2007 3:48 am
Posts: 7
Location: FRANCE
Ok, if I understand well, my object must first been evicted from it's first session and then put into the new session.

My new problem is to associate the object to the new session : which ISession must I use to do this???

Thank you for any answer.

Laurent MONDEIL


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.