[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3899) Inconsistencies when processing changes to read-only and immutable entities

Gail Badner (JIRA) noreply at atlassian.com
Wed May 6 16:55:13 EDT 2009


Inconsistencies when processing changes to read-only and immutable entities
---------------------------------------------------------------------------

                 Key: HHH-3899
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3899
             Project: Hibernate Core
          Issue Type: Bug
            Reporter: Gail Badner


I've noticed that there are inconsistencies when read-only and immutable entities are modified. I've added some unit tests to org.hibernate.test.immutable.ImmutableTest and created org.hibernate.test.readonly.ReadOnlyVersionedNodesTest which show the inconsistencies.

The same behavior is seen in Branch_3_2, Branch_3_3, and trunk. 

The inconsistencies in org.hibernate.test.immutable.ImmutableTest are:

ImmutableTest.testImmutable():
If an immutable entity with an immutable collection is associated with the session, an addition to the immutable collection is ignored

ImmutableTest.testImmutableCollectionWithUpdate:
If Session.update() is used to associate an immutable entity with an addition made to its immutable collection, then Hibernate detects that the reassociated entity has a dirty collection and  HibernateException is thrown

ImmutableTest.testImmutableCollectionWithMerge: 
If Session.merge() is used to associate  an immutable entity with an addition made to its immutable collection, then, later when the transaction is committed, Hibernate detects that an immutable collection was changed and  HibernateException is thrown

The inconsistencies in org.hibernate.test.readonly.ReadOnlyVersionedNodesTest are:
 
ReadOnlyVersionedNodesTest.testAddNewChildToReadOnlyParent():
If a read-only entity is associated with the session and a new child entity is added to collection, the new child entity is not persisted when the transaction is committed

ReadOnlyVersionedNodesTest.testUpdateParentWithNewChildCommitWithReadOnlyParent(): 
ReadOnlyVersionedNodesTest.testMergeDetachedParentWithNewChildCommitWithReadOnlyParent():
ReadOnlyVersionedNodesTest.testGetParentMakeReadOnlyThenMergeDetachedParentWithNewChildC():
If Session.merge() or Session.update() is used to associate a parent entity with a new child entity in its collection, and that parent entity is made read-only, then, later when the transaction is committed, the new child entity is persisted and it is associated with the parent

ReadOnlyVersionedNodesTest.testAddNewParentToReadOnlyChild(): 
If a  read-only entity is associated with the session and a new parent entity is assigned, the new parent entity is not persisted when the transaction is committed

ReadOnlyVersionedNodesTest.testUpdateChildWithNewParentCommitWithReadOnlyChild():  
If Session.update() is used to associate a child entity with a new parent entity, and the child entity is made read-only, later, when the transaction is committed, the new parent entity is persisted, but it is not associated with the child

ReadOnlyVersionedNodesTest.testMergeDetachedChildWithNewParentCommitWithReadOnlyChild():
ReadOnlyVersionedNodesTest.testGetChildMakeReadOnlyThenMergeDetachedChildWithNewParent():
If Session.merge() is used to associate a child entity with a new parent entity, and the child entity is made read-only, later, when the transaction is committed, the new parent entity is persisted, but it is not associated with the child; in addition the version on the parent is incremented.

If any of these results appear to be due to a bug, the test name should be changed to end in FailureExpected until the bug is fixed.

-- 
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