cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Menard" <>
Subject RE: Duplicates in to-many relationships
Date Tue, 19 Jun 2007 21:12:29 GMT
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.


> -----Original Message-----
> From: Mike Kienenberger [] 
> Sent: Tuesday, June 19, 2007 12:15 PM
> To:
> 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.

View raw message