I have not had duplication issues so far. But I will double check now. I added this code b/c of the problems with the null values, so it isnt the root cause for my problem. At the moment it still looks good. It seems that the prefetch helped. I am very puzzled about it :-)
On Fri, Sep 16, 2011 at 8:30 PM, Michael Gentry <mgen...@masslight.net> wrote: > I seem to recall doing a setX() followed by an addToY() causes a > duplicate Y to be added. I'd have to double check this, but that is > my recollection. > > On Fri, Sep 16, 2011 at 2:19 PM, Andrus Adamchik <and...@objectstyle.org> > wrote: >>> but may cause duplication issues for addToY(). >> >> I hope it doesn't. But since I am trained to just set the rel in one >> direction, I may not be aware of the issue. >> >> >> On Sep 16, 2011, at 9:12 PM, Mike Kienenberger wrote: >> >>> On Fri, Sep 16, 2011 at 4:22 AM, Christian Grobmeier >>> <grobme...@gmail.com> wrote: >>>> userRoles.setUser(user); >>>> userRoles.setRole(role); >>>> user.addToUserRoles(userRoles); >>>> role.addToRolesToJoin(userRoles); >>> >>> Again, unless, you've specifically made both relationships >>> unidirectional (the default is bidirectional), you are actually >>> setting both sides of the relationship twice. Not an issue for a >>> SetX(), but may cause duplication issues for addToY(). >>> >> >> > -- http://www.grobmeier.de