-->
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.  [ 7 posts ] 
Author Message
 Post subject: simple session.lock question
PostPosted: Tue Sep 20, 2005 11:58 am 
Newbie

Joined: Mon Feb 07, 2005 10:05 am
Posts: 3
What happens if you use session.lock() on a detached object that has been modified?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 9:35 pm 
Regular
Regular

Joined: Sat Aug 28, 2004 4:15 pm
Posts: 61
That depends on the lockmode that you specify.

Read: http://www.hibernate.org/hib_docs/api/n ... e.LockMode)

_________________
Joe W


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 9:40 pm 
Newbie

Joined: Mon Feb 07, 2005 10:05 am
Posts: 3
I've already read that. The docs say you should only use session.lock() if you're sure that the object hasn't been modified. So what happens if you reconnect an object that was modified? An error? Overall weird behavior?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 9:49 pm 
Regular
Regular

Joined: Sat Aug 28, 2004 4:15 pm
Posts: 61
Well, lets say you use session.lock(myObject, LockMode.NONE)

This will reassociate your detached object with the session.

Did you read the following:
http://www.hibernate.org/hib_docs/v3/re ... ns-locking

I realize it can be a bit confusing but I think this page answers your question.


If not, try asking it another way or giving a usage example and I'll try to help.

_________________
Joe W


Top
 Profile  
 
 Post subject: Re: simple session.lock question
PostPosted: Wed Sep 21, 2005 6:34 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
kds wrote:
What happens if you use session.lock() on a detached object that has been modified?

lol, You'll burn in the devil's flames or something like that ;-)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 21, 2005 3:52 am 
Newbie

Joined: Mon Nov 14, 2005 3:35 pm
Posts: 3
Hi Kds, did you ever find an answer for your question (what are the consequences of reassociating a modified object with LockMode=NONE) ?


Top
 Profile  
 
 Post subject: Seems to be dangerous
PostPosted: Thu Aug 24, 2006 4:30 am 
Newbie

Joined: Thu Aug 24, 2006 4:05 am
Posts: 2
http://forum.hibernate.org/viewtopic.php?t=961312


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