[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1668?page=c...
]
Josh Moore commented on HHH-1668:
---------------------------------
The PeristentMapTest additions in hhh-1668.tests.txt are no longer valid. Somewhere a
change has made the keySet() and values() sets immutable (perfect). The PersistentListTest
and Co. however still fail.
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira