hibernate cascade - update child to null -
i have 1 many relationship between event , session. i'd cascade update event fk in session null when delete corresponding event. clue how this? , advance.
hibernate or jpa unfortunately don't have cascade type 'set null' should able @preremove
on 1 side (owner):
@onetomany(mappedby="whatever") public list<someentity> getsomeentity(){ return someentity; } @preremove public void ondelete(){ for(someentity se : getsomeentity()){ se.setowner(null); } }
hope helps.
Comments
Post a Comment