-->
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: Why can't you re-associate a dirty detached object?
PostPosted: Mon Nov 28, 2005 9:31 am 
Newbie

Joined: Wed Nov 16, 2005 11:20 am
Posts: 11
I have an application which allows the user to edit a record over a long period of time. The record should not be saved to the database until a save button is clicked. Detached objects sounded perfect, but I have a problem. In various sessions after the one in which the record being edited was loaded I need to query/load other objects which may directly or indirectly link back to the record being edited, or visa-versa. If I don't re-associate the record, I end up with two different java objects, and hence an error when the user finally tries to save the record. If I DO re-associate the record (using session.lock(obj,LockMode.NONE)) it complains that the object is dirty. Is there a sensible way round this?

Ideally, I would also like to be able to "refresh" these linked-but-not-being-edited objects from the database, but the hibernate documentation says that the refresh method should not be used to implement long application transactions (but gives no reason). Why is this?

Any pointers in the right direction would be much appreciated. Oh, and I'm using Hibernate 3


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.