-->
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: Explicit commit?
PostPosted: Sat May 28, 2005 11:46 pm 
Beginner
Beginner

Joined: Sat May 07, 2005 12:01 pm
Posts: 33
Hi,
Is there a way to have Hibernate persist only objects that I specifically want to save? In other words, the user may modify an object but abandon the changes -- with the standard behaviour, these changes will be persisted upon "flush". I don't want to close the session or use "evict". I want to keep the session live, but objects should only be persisted when I expressively want to save them.

Also, is there a quick way to determine whether an object is persistent or detached?

Thanks for any advice.

Jen


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 12:27 am 
Regular
Regular

Joined: Tue May 24, 2005 10:19 am
Posts: 65
1)try use Transaction api.
2) use
Code:
Session.contains(Object object)

Quote:
Check if this instance is associated with this Session.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 4:26 am 
Beginner
Beginner

Joined: Sat May 07, 2005 12:01 pm
Posts: 33
Cool, thanks. What is the best way to re-attach a detached object? I want to use lock(LockMode.NONE), but the doc says the object cannot be modified. What if I want to reattach an object that I've changed, without forcing ot to be persisted?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 31, 2005 4:28 pm 
Regular
Regular

Joined: Tue May 24, 2005 10:19 am
Posts: 65
re-attach and not save modified object? not is good. try other way.


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.