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