[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-5742) PersistentSet#iterator() iterates over element which had been removed from set

Gail Badner (JIRA) noreply at atlassian.com
Mon Jan 10 15:44:05 EST 2011


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5742?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gail Badner updated HHH-5742:
-----------------------------

    Fix Version/s: 4.0.0.Alpha1
                   3.6.1

> 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.5.0-Final, 3.6.0
>         Environment: 3.6.0FINAL, database indipendent (attached testcase based on hsqldb)
>            Reporter: Guenther Demetz
>            Priority: Critical
>             Fix For: 3.6.1, 4.0.0.Alpha1
>
>         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