> P.S. I'm not keen on the way you add items to bidirectional association.
The
> correct idiom is:
>
> parent.getChildren().add(child); file://yes, even if the children
collection is
> readonly="true"
> child.setParent(parent);
> sess.save(child);
>
> omitting the first line could cause bugs in more complicated
circumstances.

Hmm - isn't this idiom inefficient ?
Doesn't parent.getChildren().add() (or any method on the collection) result
in loading all the children ?

If the only intention is to add the child to the parent shouldn't the
child.setParent(parent) be enough ?

And then if I wish to have the parent in a "correct" state then I just do a
s.load(parent, parent.getId()) ?

/max





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to