From: Christian B. <chr...@bl...> - 2002-12-19 09:32:52
|
On 19 Dec (09:20), Jim Downing wrote: > Thanks - I'd used the advance in Tom's manual to do the mapping, but I > was trying to maintain the relationship in my persistent objects > (rather than making the client do it, as in the FAQ), which was > probably the cause of my problems. Thats exactly what I'm doing: class Child { public setParent(Parent newParent) { // Remove myself from old Parent if (this.parent != null) { this.parent.getChildren().remove(this); } // Add to new Parent newParent.getChildren().add(this); // Set new Parent this.parent = newParent; } } This is similar to the Composite Pattern (or better, a part of it): http://www.idg.net/english/crd_composite_948016.html -- Christian Bauer tu...@in... |