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

Reply via email to