-->
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.  [ 2 posts ] 
Author Message
 Post subject: session.lock with LockMode.NONE
PostPosted: Fri Feb 13, 2004 12:27 pm 
Newbie

Joined: Tue Aug 26, 2003 12:31 pm
Posts: 14
Just want to make sure we are doing this correctly...

1. We want to load an object
2. Update the object in another layer in a browser. (disconnected)
3. Come back and reassociate the object with a Session and use saveOrUpdate to commit the new changes and updates.

Question: Is session.lock(foo, LockMode.NONE) the same as reassociating the transient object with a new session without doing selects/reads from the database?

I just want to make sure that there is nothing else that is going on here (with session.lock with LockMode.NONE). We are using Timestamps for optimisitic locking strategy since our environment is not highly concurrent on the records we are working with and should suffice.

Is there a better way to reassociate the object with a new Session. If this is the way to do this then I think that the API should be updated with session.reassociate(Object o). This would be a wrapper for the above session.lock method which seems like a confusing name for what is happening.

Thanks,

Mark
[code][/code]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 13, 2004 12:33 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
LockMode.NONE: Don't go to the database unless the object is not in either cache.

LockMode.READ: Bypass both levels of the cache and perform a version check, to verify that the object is the same version that currently exists in the database.

The others are pessimistic and exclusive locks for the duration of the transaction on that object.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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