I am using Hibernate 3.2.1.
I have a one-to-one with shared primary keys as the example in hibernate annotations doc:
Code:
@Entity
public class Body {
@Id
public Long getId() { return id; }
...
}
@Entity
public class Heart {
@Id
public Long getId() { ...}
@OneToOne
@PrimaryKeyJoinColumn
public Body getBody() {
return body;
}
}
If I want to delete the Heart, but not the Body, what changes would I need to make?
Before deleting Heart, I have tried setting the body to null,
Code:
heart.setBody(null);
session.delete(heart);
but Hibernate tries to delete the Body first, which I don't get why?
Thanks,
-Mujahid