-->
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.  [ 1 post ] 
Author Message
 Post subject: Connecting loaded objects to detached objects
PostPosted: Wed Feb 02, 2005 9:55 am 
Newbie

Joined: Thu Nov 04, 2004 10:24 am
Posts: 17
I am working with Hibernate 2.1.6 in a Swing GUI.

Class B has a field of type A.

Detached object a of class A is referenced by the GUI. I do a query (by HQL or load-by-ID) that loads b of class B from the database. Logically, b should point to a, but Hibernate doesn't know that, so when it loads b, and I navigate the reference, a "copy of" a is created and loaded as well.

But I need b to be hooked up to a. How do I do I make Hibernate recognize that the reference should point to the already-loaded (detached) object?

Do I lock() a at the beginning of the Session? That could be hard to do if, instead of just the one a, I have hundreds of detached objects of type A referenced by the GUI and I don't know which one needs to be lock-ed.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.