While this is true, I always thought a ToManyList really should be an
ordered set. I must admit, I was a bit perplexed the first time I ended
up with duplicates in one of my lists, but found the DB inserts were
correct. I actually had one Web app where it wasn't clear how
duplicates were getting in at all, so I wrote an
EnhancedCayenneDataObject that specifically disallowed duplicates being
added. A bit of a performance hit, for sure, but the underlying data
model matched the DB much more accurately and I only paid the price when
calling on of the add-to-list methods.
-- Kevin> -----Original Message----- > From: Mike Kienenberger [mailto:mkienen..mail.com] > Sent: Tuesday, June 19, 2007 12:15 PM > To: use..ayenne.apache.org > Subject: Re: Duplicates in to-many relationships > > Unlike Hibernate, the object graph is maintained even before you save. > > If you use "mySecondObject.setTheObject(myFirstObject)", then > the equivalent for > "myFirstObject.addToMyRelation(mySecondObject)" is already > done for you. > > This is why you're seeing two copies -- you're effectively > calling the addToMyRelationship twice.
This archive was generated by hypermail 2.0.0 : Tue Jun 19 2007 - 17:12:54 EDT