-->
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.  [ 6 posts ] 
Author Message
 Post subject: Reassociating a disconnected Object with Session
PostPosted: Mon Sep 22, 2003 5:12 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Hi,

I have an object which has lazy collection properties. I hand this object to the application (a swing app, so now way to keep Session open). When the data from the collection is needed (User expands a tree node), the Object is passed back to the server, where I want to initialize the collections, and pass the object back to the client again.

I have this working so far allready, however to initialize the Collections, I have to do a Session.load() with the id of the Object passed in to the Server.

Is there another way to reassociate the Object with the Session, so I can initialize the Collection, without the need to reload the Object from the DB?

Michael


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 22, 2003 5:40 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Use session.update(), or the newer session.lock()


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 22, 2003 7:01 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
I tried Session.lock allready, which throws an Exception "Tried to lock a transient Object". Session.update() works, but still issues an update - can this be avoided somehow?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 22, 2003 8:32 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
session.lock(obj, LockMode.NONE)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2003 1:52 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
note that lock(transient, lockMode) only works in Hibernate 2.1.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2003 2:21 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Ah, thats why it doesnt work, was still using the 2.0.1 jar-File :)

Thanks, Michael


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