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

Gail Badner (JIRA) noreply at atlassian.com
Wed Mar 10 05:53:47 EST 2010


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

Gail Badner updated HHH-3899:
-----------------------------

       Assignee: Gail Badner
    Description: 
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
GB: Addressed by HHH-4941.

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
GB: This is expected behavior.

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
GB: This is expected behavior.

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
GB: This is due to HHH-4993.

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
GB: This is expected behavior

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
GB: This is due to HHH-4993.

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
GB: The cascade-save to the parent is expected. 
GB: The child is not associated with the parent due to HHH-4941.

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.
GB: This is due to HHH-4992.

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.

  was:
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.


Added comments to the description indicating which behavior is expected. When the behavior is not expected, I've referred to other issues that cover the problem.

> 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
>            Assignee: 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
> GB: Addressed by HHH-4941.
> 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
> GB: This is expected behavior.
> 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
> GB: This is expected behavior.
> 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
> GB: This is due to HHH-4993.
> 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
> GB: This is expected behavior
> 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
> GB: This is due to HHH-4993.
> 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
> GB: The cascade-save to the parent is expected. 
> GB: The child is not associated with the parent due to HHH-4941.
> 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.
> GB: This is due to HHH-4992.
> 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