[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5129) TransientObjectException thrown in cascading collection with DELETE_ORPHAN if object is added and removed from collection

José González Gómez (JIRA) noreply at atlassian.com
Fri Apr 16 09:32:58 EDT 2010


TransientObjectException thrown in cascading collection with DELETE_ORPHAN if object is added and removed from collection
-------------------------------------------------------------------------------------------------------------------------

                 Key: HHH-5129
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5129
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.3.2
         Environment: hibernate-core-3.3.2.GA
hibernate-annotations-3.4.0.GA
hibernate-entitymanager-3.4.0.GA
MySQL 5.1
mysql-connector-java-5.1.12
            Reporter: José González Gómez
         Attachments: hibernate-test-case.zip

I have a parent entity with a @OneToMany collection, with CascadeType.ALL and CascadeType.DELETE_ORPHAN. If I follow the following steps Hibernate throws a TransientObjectException:
1. Load the parent entity with its collection from database
2. Add a child entity to the collection
3. Add a second child entity to the collection
4. Remove the second child entity from the collection
5. Flush / commit the transaction

The bug cannot be reproduced if:
1. The parent entity is created in the same transaction where the rest of operations are made
2. All the added children are removed

The following is irrelevant for reproducing the bug:
1. The relationship may be unidirectional or bidirectional

I've attached a maven project with a test case with a trimmed down version of our production code showing the bug.

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