doesn't remove the orphan entry

Description

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

Activity

Show:
Duplicate

Details

Assignee

Reporter

Components

Affects versions

Priority

Created March 22, 2011 at 2:31 PM
Updated October 31, 2012 at 7:42 PM
Resolved October 31, 2012 at 7:42 PM