[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-3782) Saving a one-to-many relationship results in unsaved transient instance exception

Adam Warski (JIRA) noreply at atlassian.com
Mon Mar 2 14:06:38 EST 2009


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

Adam Warski resolved HHH-3782.
------------------------------

         Assignee: Adam Warski
       Resolution: Cannot Reproduce
    Fix Version/s: 3.5

I tried and that's true that I get the error, but I get it regardless if I switch Envers on or off.

What you are missing, is the cascade on GreetingPO.getGreetingSet: the annotation there should be for example @ManyToOne(cascade = CascadeType.ALL).

With the cascade turned on, the test passes with and without Envers.

> Saving a one-to-many relationship results in unsaved transient instance exception
> ---------------------------------------------------------------------------------
>
>                 Key: HHH-3782
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3782
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: envers
>    Affects Versions: 3.3.1
>         Environment: Hibernate 3.3.1.GA
> Oracle XE 10g
>            Reporter: Daniel Meyer
>            Assignee: Adam Warski
>             Fix For: 3.5
>
>         Attachments: envers-with-collections.zip
>
>
> When I create a transient set and a transient item, point them to each other, and then commit the set-with-the-item-in-it, I get this exception:  "org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing"
> This does not happen when I'm not using envers.
> The attached project's testComplexCreate() method demonstrates the error.  To run the tests, execute "mvn clean install" (requires Apache Maven, I use version 2.0.9); then target/surefire-reports/com.example.db.EnversWithCollectionsTest.txt will have the stack trace.

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