AW: [OJB-developers] Collections problem..
Brought to you by:
thma
From: Mahler T. <tho...@it...> - 2002-05-29 11:09:54
|
Hi Andrew, This is very easy to fix! If you are using OJB in ODMG mode just set all <auto.update> and <auto.delete> entries to false. This avoids the double insertion that you noticed already. This is documented in Tutorial3.html: http://objectbridge.sourceforge.net/tutorial3.html#cascading hth, Th > -----Urspr=FCngliche Nachricht----- > Von: Andrew Pietsch [mailto:api...@op...] > Gesendet: Dienstag, 28. Mai 2002 11:58 > An: OJB Developers mailing list > Betreff: [OJB-developers] Collections problem.. >=20 >=20 > Howdy, >=20 > I seem to be having a bit of trouble storing collections. =20 > I've got a Site object that contains > an ArrayList of CollectionPoint objects. Each=20 > CollectionPoint also has reference back to it's > parent Site object. When I create a Site and add a single=20 > CollectionPoint to it and persist the=20 > Site, it seems that the CollectionPoint object is being=20 > inserted twice into the database resulting > in a primary key violation. I've narrowed it down a little=20 > and it seems that the ObjectEnvelopeTable > iterates over both the Site and CollectionPoint calling=20 > commit on both. The problem seems to be that=20 > while persisting the Site, the CollectionPoint is persisted=20 > via storeCollections(..), and=20 > is then persisted again by the ObjectEvelopeTable. >=20 > This is my first OJB project so I'm not sure if I've screwed=20 > things up. I checked out of cvs just a=20 > few minutes ago so I should be the latest source. I've=20 > attached the output trace and my respositry.xml > just in case I've done something crazy.. >=20 > Also, I was just wondering if references could be implemented=20 > (theoretically speaking) without using a > distinct ID field in the referring object, ie My=20 > CollectionPoint must have a Site attribute and a siteId=20 > attribute, I'd love to ditch the siteId. Please feel free to=20 > call me an idiot if I've overlooked the > obvious.. I just thought it would be a nice to have.. (c: >=20 > Keep up the excellent work!! >=20 > Thanks > Andrew >=20 |