[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5742) PersistentSet#iterator() iterates over element which had been removed from set
Guenther Demetz (JIRA)
noreply at atlassian.com
Fri Nov 19 03:03:15 EST 2010
PersistentSet#iterator() iterates over element which had been removed from set
------------------------------------------------------------------------------
Key: HHH-5742
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5742
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.0, 3.5.0-Final
Environment: 3.6.0FINAL, database indipendent (attached testcase based on hsqldb)
Reporter: Guenther Demetz
Priority: Critical
Attachments: TestIterateOverExtraLazyCollectionWithInverseOwner.jar
PRECONDITONS:
-the relation is declared OneToMany with inverse owner (=mappedBy attribute specified)
-the relation is declared extra lazy @LazyCollection (LazyCollectionOption.EXTRA)
BUG: PersistenSet.iterator().next() returns element which previously had been removed from the set
myPersistenSet.remove(obj);
assertFalse(myPersistenSet.iterator().next() == obj);
CAUSE:
PersistentSet#iterator() implementation does differ from PersistentSet#contains() and PersistentSet#size() as it doesn't call the necessary flush() if:
- the set isn't initialized
- the set is declared extra lazy
- the set has queued Operations (hasQueuedOperations == true) to be flushed
Please see attached TESTCASE for more details.
This IMHO is a critical bug, as it could create serious damage to companies using hibernate:
imagine a company cancels a order-position and nevertheless the canceled position is subsequently delivered or/and invoiced to the customer, because the iterator returns the removed element.
Thanks for attention.
--
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