I am creating a one-to-many relationship. so, i have a parent and a child. The cascade attribute is set to all.
I was wondering, if we consider the following piece of code:
Parent p = (Parent) session.load(Parent.class, pid); Child c = new Child("child element"); p.addChild(c); session.flush();
- Q1) If the parent owns the relationship, as in , for the parent inverse=false, then would the child element addition be updated in teh database?
- Q2) If the child owns the relationship, as in , for the parent inverse=true, then will the child element addtion be updated in the databse?
- Q3) Who owns the relationahsip does not make a difference in the above code in terms of whether the updaet will be seen or not?
thanks a lot