openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinaki Poddar <ppod...@apache.org>
Subject Re: Bidirectional OneToMany with Enchancer
Date Tue, 25 May 2010 15:16:39 GMT

The application will need to set the bi-directional relation. One can do that
consistently within the domain class itself or outside

Inside the domain

Parent.java
public void setChildren(Set<Children> children) {
   for (Child c : children) c.setParent(this);
   this.children = children;
}


Or outside:

Hospital.java // a non-persistent class

void haveBabies(Parent p, Set<Children> children) {
   p.setChildren(children);
   for (Child c : children) c.setparent(p);
}

-----
Pinaki 
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Bidirectional-OneToMany-with-Enchancer-tp5091015p5098927.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message