optimistic-lock="dirty" does not throw StaleObjectException if object modified
by another session using detached objects
------------------------------------------------------------------------------------------------------------------------
Key: HHH-2698
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2698
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.2
Environment: Tomcat 5.5, Hibernate 3.2, Spring 2.0
Reporter: Alex McCarrier
Priority: Minor
We have two clients, a web client and a swing client. With
optimistic-lock="dirty" defined for an entity, if two web clients modify the
same field on the same entity, it throws StaleObjectException as expected.
We also have a swing client that sends detached entities back and forth. If the detached
client modifies and entity at the same time as the web client, no exception is thrown, but
the web client fails the update. The reason being is the web client has an extra where
clause that includes the modified field, instead of just the primary key. Since the
detached client changed the value already, the web client finds nothing to update.
For example, changing description field, web client does something like:
update MyEntity set description = "web description" where id = 1 and description
= "old description";
detached client does before web client completes:
update MyEntity where id = 1 set description = "some other description";
web client continues and doesn't find anything to update, because where clause in
first query fails.
I would think in this particular scenario, if the web client finds nothing to update, it
would throw a StaleObjectStateException.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira