[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-6037) doesn't remove the orphan entry

Premraj Motling (JIRA) noreply at atlassian.com
Tue Mar 22 08:34:08 EDT 2011


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

Premraj Motling commented on HHH-6037:
--------------------------------------

described the issue @ http://stackoverflow.com/questions/5389561/referential-integrity-with-one-to-one-using-hibernate

> doesn't remove the orphan entry
> -------------------------------
>
>                 Key: HHH-6037
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6037
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.5.3
>         Environment: Hibernate 3.5.3, JPA 2, ORACLE 11g 
>            Reporter: Premraj Motling
>
> Hibernate don't delete the orphan entries with OneToOne even after set to null
> @Entity
> public class Foo{
>     @Id
>     private long foo_id;
>     private String name;
>     @OneToOne(mappedBy = "foo", orphanRemoval = true)
>     private FooProperties fooProperties;
> }
> @Entity
> public class FooProperties{
>     @Id
>     private long fp_id;
>     private String phoneNumber;
>     @OneToOne
>     @JoinColumn(name = "foo_id",  nullable = false)
>     private Foo foo;
> }
> and if I do - 
> Foo foo = entityManager.find(Foo.class, fooId);
> foo.getFooProperties.setFoo(null);
> foo.setFooProperties(new FooProperties("xxx-xxx-xxx"));
> entityManager.merge(foo);
> its not deleting the FooProperties

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