Bruce, That's what I was hoping to get around, but if that's the best way to do it I'll plunge ahead.
Seems to me that this type of thing should be handled by a persistance engine. Don't mean this as a swipe at Castor, merely something to think about for future iterations. -Ron -----Original Message----- From: Bruce Snyder [mailto:[EMAIL PROTECTED] Sent: Monday, May 02, 2005 11:21 AM To: [email protected] Subject: Re: [castor-dev] many-to-many mapping.. On 5/2/05, Ronald Rudy <[EMAIL PROTECTED]> wrote: > Here is my mapping: > > <class name="com.xyz.ObjectOne" identity="oneId" > key-generator="SEQUENCE"> > <description>"First of Many-to-Many Object"</description> > <map-to table="object_one"/> > <cache-type type="none"/> > <field name="oneId" type="integer"> > <sql name="object_one_id" type="integer"/> > </field> > > ... > > <field name="objectTwo" type="com.xyz.ObjectTwo" > collection="arraylist"> > <sql name="object_two_id" many-table="objectone_objecttwo_map" > many-key="object_one_id" key-generator="SEQUENCE" /> > </field> Ronald, The repsonse in another thread provided by Emir is correct insomuch as mapping the bi-directional relationship between the two objects and marking certain fields as lazy loaded. In addition to that, Castor only supports the key-generator attribute on the class element. Placing a key-generator attribute on the sql element as above will have no effect as it is not supported. In order to get around this, in the past, I've modeled the bridge table as a Java object and persisted it along with the rest of the object model. Doing this will allow the key-generator to be specified on that object so that a key will be created for the table. Bruce -- perl -e 'print unpack("u30","D0G)[EMAIL PROTECTED]&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*" );' The Castor Project http://www.castor.org/ Apache Geronimo http://geronimo.apache.org/

