say I have two entities like Person and Migration @entity class Person{ @id id @OneToMany(mappedBy="fromAddress", cascade={CascadeType.REMOVE}, orphanRemoval=true) private Set<Migration> from = new HashSet<Migration>();
@OneToMany(mappedBy="toAddress", cascade={CascadeType.REMOVE}, orphanRemoval=true) private Set<Migration> to = new HashSet<Migration>(); }
-- @entity class Migration{ @Id id @ManyToOne private Person fromAddress; @ManyToOne private Person toAddress; }
when I remove person which is refrenced in fromAddress then child row(Migration row) gets deleted but when Person which is refrenced in toAddress then child row is not deleted, instead toAddress column has null value in it.
How could i delete toAddress entire row in Migration entity?
|