[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-1668) PersistentSet.add() marks as dirty even if Set is not updated
Koda Janh (JIRA)
noreply at atlassian.com
Wed Aug 30 22:25:24 EDT 2006
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1668?page=all ]
Koda Janh updated HHH-1668:
---------------------------
Attachment: PersistentSet.patch
Here is a patch against HEAD branch. Please incorporate it into the next release.
> PersistentSet.add() marks as dirty even if Set is not updated
> -------------------------------------------------------------
>
> 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
> 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