Hello all,
Simple scenario:
I have a Person class, where each person has a House.
A house itself is oblivious to persons, it's a uni-directional relationship.
Code:
@Entity
public class Person {
private House house;
@ManyToOne
public House getHouse() { return this.house; }
public void setHouse(House house) { this.house = house; }
}
Now, what I want is to be able to delete a House without worrying about whether some person points to it or not.
If a Person happens to point to this House, I'd like his house field to be set to NULL.
I went through all different sorts of forums and jiras, and can't seem to find out -
Is this supported? How is this done (javax.persistence \ Hibernate) ?
Should I manually go and set the house field of Persons pointing to this House to null??
Thanks !