[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-2698) optimistic-lock="dirty" does not throw StaleObjectException if object modified by another session using detached objects

Christian Bauer (JIRA) noreply at atlassian.com
Tue Jul 3 07:54:52 EDT 2007


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christian Bauer resolved HHH-2698.
----------------------------------

    Resolution: Rejected

Use version numbers or timestamps. You can not use optimistic-lock="dirty|all" with detached objects conceptually.


> 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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list