[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5740) EXTRA Lazy collection with inverse owner: PersistenSet still contains previosly removed elements

Guenther Demetz (JIRA) noreply at atlassian.com
Thu Nov 18 03:46:13 EST 2010


EXTRA Lazy collection with inverse owner: PersistenSet still contains previosly removed elements 
-------------------------------------------------------------------------------------------------

                 Key: HHH-5740
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5740
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.6.0, 3.5.0-Final
         Environment: Hibernate 3.6.0 (also 3.5.0 is affect of this bug), database indipendent (attached Testcase is based on hsqldb)
            Reporter: Guenther Demetz
            Priority: Critical
         Attachments: TestExtraLazyCollectionWithInverseOwner.jar

When mapping a Set with inverse owner (= specifying mappedBy attribute)
and annotated with
@org.hibernate.annotations.LazyCollection (LazyCollectionOption.EXTRA)
then the removal of single elements doesn't work as expected:
the PersistentSet still contains elements which have previously removed.

..
assertTrue(a.assD.remove(d));    // removing element d from PersistentSet, this assert goes well
assertFalse(a.assD.contains(d)); // asserting PersistentSet doesn't contain element d anymore, FAILS !!

The contains method implementation of PersistentSet properly calls flush()
before executing the select-query, but anyway for some reason the registered DelayedOperation
(as before enqueued by the remove call) isn't properly brought to execution if the collection is declared with inverse owner.


This IMHO is a critical bug, as this behavior clearly violates the contracts of method
java.util.Set#remove(java.lang.Object) where the specifications says:
<quoted: "the set will not contain the specified element once the call returns">
Furthermore it could create serious damage to companies using hibernate:
imagine for example a company cancels a order-position and nevertheless the canceled position is subsequently delivered and invoiced to the customer.

Please see attached testcase for more details.
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