[OJB-developers] Collections problem..
Brought to you by:
thma
From: Andrew P. <api...@op...> - 2002-05-28 09:56:39
|
Howdy, I seem to be having a bit of trouble storing collections. I've got a Site object that contains an ArrayList of CollectionPoint objects. Each CollectionPoint also has reference back to it's parent Site object. When I create a Site and add a single CollectionPoint to it and persist the Site, it seems that the CollectionPoint object is being inserted twice into the database resulting in a primary key violation. I've narrowed it down a little and it seems that the ObjectEnvelopeTable iterates over both the Site and CollectionPoint calling commit on both. The problem seems to be that while persisting the Site, the CollectionPoint is persisted via storeCollections(..), and is then persisted again by the ObjectEvelopeTable. This is my first OJB project so I'm not sure if I've screwed things up. I checked out of cvs just a few minutes ago so I should be the latest source. I've attached the output trace and my respositry.xml just in case I've done something crazy.. Also, I was just wondering if references could be implemented (theoretically speaking) without using a distinct ID field in the referring object, ie My CollectionPoint must have a Site attribute and a siteId attribute, I'd love to ditch the siteId. Please feel free to call me an idiot if I've overlooked the obvious.. I just thought it would be a nice to have.. (c: Keep up the excellent work!! Thanks Andrew |