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

Josh Moore (JIRA) noreply at atlassian.com
Sun Sep 3 05:02:25 EDT 2006


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

Josh Moore updated HHH-1668:
----------------------------

    Attachment: hhh-1668.tests.txt

hhh-1668.tests.txt contains tests for PersistentBag and PersistentList, Steve. (Copied from your PSet and PMap tests). Also added to PMapTest a preliminary check for the SetProxy returned by PMap.keySet() and PMap.values(). The iterator calls all seem to be harmless, at least I can't think of a way to make the tests fail. And PIdentifierBag needs testing but I'm too unfamiliar with that.

> 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, hhh-1668.tests.txt
>
> 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