[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5364) TransientObjectException for OneToMany with orphanRemoval and cascade

Cedric Thiebault (JIRA) noreply at atlassian.com
Thu Jul 8 12:38:13 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5364?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=37675#action_37675 ] 

Cedric Thiebault commented on HHH-5364:
---------------------------------------

Here is the code to avoid people to download test case:

*Parent.java*
@OneToMany(mappedBy = "parent", orphanRemoval = true) // it works with orphanRemoval = false
private List<Child> childs;

*Child.java*
@ManyToOne(optional = false)
@Cascade( { PERSIST, MERGE, REFRESH, SAVE_UPDATE, REPLICATE, LOCK, DETACH })
private Parent parent;


> TransientObjectException for OneToMany with orphanRemoval and cascade
> ---------------------------------------------------------------------
>
>                 Key: HHH-5364
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5364
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: annotations, core
>    Affects Versions: 3.5.2
>            Reporter: Cedric Thiebault
>         Attachments: TestCase.zip
>
>
> Environnement:
> - basic one to many relation parent/child
> - orphanRemoval=true for parent 
> - cascade only from child to parent (persist cascade only because I don't want to delete the parent if I delete a child)
> When I add a child to the parent and I save the child, I have a TransientObjectException.
> But if I remove orphanRemoval, it works.
> See the attached test case (if you set orphanRemoval=false on the Parent, test will pass).

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