Can JBoss handle cmp optimistic locking that spans web requests?


Here's the scenario that i'm trying to get working: Open two browser
windows and display a value for a sample field. Update the value on one.
Then update the value on the second, without refreshing first, and i'm
hoping to get an exception signifying the stale data displayed, but i
don't the update works fine. If this is possible, how do i make this happen?

I have constructed a very simple sample project based on the optimistic
locking section in the paydocs and have tried all but the UID method of
locking but can't seam to get it to work. I'm wondering if someone might
be able to identify what i have wrong.

The sample project can be downloaded here:
http://www.sharpuniverse.com/jboss/entitybeanlocking/sample.zip All
you'll need to is set your jboss install dir in the build.properties
then run the deploy target and go to the "entitybeanlocking" context.

The JSP page reads the value from the db, puts the entitybean in the
session and displays the current value to the page. On subsequent
requests it gets the entitybean out of the session. The update servlet
gets the entitybean out of the session and updates the value. In order
to get optimistic locking working, it sounds like i need to get and set
the value from the same reference, hence why i'm putting the entity bean
reference in the session.

The documentation refers optimistic locking working "within the
transaction", which could be my problem considering i'm executing across
multiple web requests. If this is the problem, can anyone suggest a
strategy for getting it to work.

thanks.
.peter




---------- CONFIDENTIALITY NOTICE: This e-mail message, including any attachments,is for the sole use of the intended recipient(s), even if addressed incorrectly, and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy or delete all copies of the original message and all attachments, including deletion from the trash or equivalent folder. Thank you.

Reply via email to