[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-1668) PersistentSet write methods mark collection as dirty even if entry is not written

Steve Ebersole (JIRA) noreply at atlassian.com
Thu Aug 31 06:25:24 EDT 2006


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1668?page=all ]

Steve Ebersole updated HHH-1668:
--------------------------------

        Summary: PersistentSet write methods mark collection as dirty even if entry is not written  (was: PersistentSet.add() marks as dirty even if Set is not updated)
    Fix Version: 3.2.1
      Assign To: Steve Ebersole

> PersistentSet write methods mark collection as dirty even if entry is not written
> ---------------------------------------------------------------------------------
>
>          Key: HHH-1668
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1668
>      Project: Hibernate3
>         Type: Bug

>   Components: core
>     Versions: 3.1.3
>     Reporter: Koda Janh
>     Assignee: Steve Ebersole
>      Fix For: 3.2.1
>  Attachments: PersistentSet.patch
>
> Original Estimate: 5 minutes
>         Remaining: 5 minutes
>
> PersistentSet gets marked as dirty even if it hasn't changed. This has negative implications for concurrency because the optimistic-lock version is incremented and StaleObjectStateException is thrown even if the underlying data remains unchanged.
> I stepped through the code and narrowed down the problem to a bug in PersistentSet.add(). A simple fix is to replace:
> if (exists==null) {
> 	write();
> 	return set.add(value);
> }
> by:
> 		if (exists==null) {
> 			boolean result = set.add(value);
> 			if (result) {
> 				write();
> 			}
> 			return result;
> }
> I verified that this fixed the problem on my end. The old code was always marking the Set as dirty whereas the new code only does so if it actually has been modified. Please commit this patch.

-- 
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