Hi Kevin, I have a similar mapping file that works. Try adding the attribute @name=[collection element's key in the many table]
In other words, change: <sql many-table="USER_GROUPS" many-key="USER_ID" /> to <sql many-table="USER_GROUPS" many-key="USER_ID" name="GROUP_ID" /> -richard -----Original Message----- From: Smith, Kevin [mailto:[EMAIL PROTECTED]] Sent: Friday, February 15, 2002 12:51 PM To: [EMAIL PROTECTED] Subject: [castor-dev] Collection dirty-checking not occuring (Castor JDO) I'm having a problem with Castor JDO and I'm hoping that someone can shed some light..... I have two classes: User and Group. The JDO mapping for them looks like this: <class name="User" identity="userid" cache-type="unlimited" auto-complete="false"> <map-to table="USERS" /> <field name="userid" type="java.lang.String" set-method="setUserId" get-method="getUserId"> <sql name="USER_ID" type="varchar" /> </field> <field name="password" type="java.lang.String" set-method="setPassword" get-method="getPassword"> <sql name="PASSWORD" type="varchar" /> </field> <field name="groups" type="Group" set-method="setGroups" get-method="getGroups" collection="collection"> <sql many-table="USER_GROUPS" many-key="USER_ID" /> </field> </class> <class name="Group" identity="id" cache-type="unlimited" auto-complete="false"> <map-to table="GROUPS" /> <field name="id" type="long" set-method="setId" get-method="getId"> <sql name="GROUP_ID" /> </field> <field name="name" type="string" set-method="setName" get-method="getName"> <sql name="GROUP_DESCRIPTION" /> </field> </class> Castor works for instantiating a user object. The user.groups collection is correctly populated if I pre-populate the underlying database table. Castor seems to pick up the changes and delete rows when I remove a Group object from the user.groups collection. However, when I _add_ a Group object to the user.groups collection and subsequently save the the User object instance to the database via Database.update(), the new row is never created. I've tried change the cache-type setting and turning on/off auto update with no effect. Does anyone see problems with my config or the logical process for saving changes? Thanks, Kevin ----------------------------------------------------------- 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
