You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ben Dotte <bd...@widen.com> on 2006/06/20 00:23:58 UTC

[OT] Tapernate and Optimistic Locking

Our Tapestry application is using Tapernate-like behavior to load
persisted objects in automatically at the beginning of each request and
now I've been asked to look into changing our database locking strategy
from pessimistic to optimistic. I've tried versioning the objects as is
suggested for Hibernate but the problem is I have no basis for
comparison between versions since each object gets reloaded at the
beginning of each request, and the StaleObjectStateException I am
expecting never gets thrown. I can't figure out how optimistic locking
would ever work unless you are using detached objects.

 

Has anyone come across a good solution to this problem without resorting
to detached objects?

 

Thanks,

Ben


RE: [OT] Tapernate and Optimistic Locking

Posted by James Carman <ja...@carmanconsulting.com>.
Tapernate allows you to use detached objects and still enforce optimistic
locking.  You have to use @Persist("reattach-merge") so that Tapernate will
try to merge() your object.  If the object stored in the session has the old
version number, you'll get the exception.

-----Original Message-----
From: Ben Dotte [mailto:bdotte@widen.com] 
Sent: Monday, June 19, 2006 6:24 PM
To: Tapestry users
Subject: [OT] Tapernate and Optimistic Locking

Our Tapestry application is using Tapernate-like behavior to load
persisted objects in automatically at the beginning of each request and
now I've been asked to look into changing our database locking strategy
from pessimistic to optimistic. I've tried versioning the objects as is
suggested for Hibernate but the problem is I have no basis for
comparison between versions since each object gets reloaded at the
beginning of each request, and the StaleObjectStateException I am
expecting never gets thrown. I can't figure out how optimistic locking
would ever work unless you are using detached objects.

 

Has anyone come across a good solution to this problem without resorting
to detached objects?

 

Thanks,

Ben




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org