Hi Bruce, That was it! Thanks for your help!
Steve... -----Original Message----- From: Bruce Snyder [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 30, 2002 12:58 PM To: [EMAIL PROTECTED] Subject: Re: [castor-dev] Strange many to many mapping behaviour This one time, at band camp, Steve Earl said: SE >Hi Bruce, SE > SE >The other many to many relationships behave the same way so it must be SE >something in my code. I've attached the objects which are being persisted SE >as well as source for the mbean that controls the CRUD stuff. SE > SE >Thanks for your help with this. SE > Steve, It looks to me like you're bypassing your own logic in either class to add each item to the other's collection. I also haven't seen your client code, so my analysis is really just a stab, but I think it's the right one. Inside of Service and ServicePackage you're using the same pattern with the adder method. For example: public void addServicePackage(ServicePackage _servicePackage) { servicePackages.add(_servicePackage); _servicePackage.services.add(this); } The ServicePackage object is being directly added to Service's Collection via the java.util.Collection method rather than via the Service method. The same goes for all the other adders I glanced at in your objects. I believe if you change the above method to work like the following example, the relations will work properly: public void addServicePackage(ServicePackage _servicePackage) { servicePackages.add(_servicePackage); _servicePackage.addService(this); } This change should be made to all the adders. Make sure you're calling the opposing objects adder method and not the java.util.Collection method. Try this out and let's see what kind of results are achieved. Bruce -- perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");' ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
