I have a simple n:m relation:

user *..* rol

I brake this with a middle table

user 1..* user_rol *..1 rol

Everything is fine, the problem is when a delete a rol from the rol
user's collection, the rol it self is deleted and I want to keep it.

Here es the code on user:

  /** @ojb.collection
   *    element-class-ref="model.security.Rol"
   *    auto-retrieve="true"
   *    auto-update="true"
   *    foreignkey="user_id"
   *    remote-foreignkey="rol_id"
   *    indirection-table="user_rol"
   */
  protected Collection roles;

Here es the auto generated code on repository_user.xml

<collection-descriptor
        name="roles"
        element-class-ref="model.security.Rol"
        indirection-table="user_rol"
        auto-retrieve="true"
        auto-update="true"
>
        <fk-pointing-to-this-class column="user_id"/>
        <fk-pointing-to-element-class column="rol_id"/>
</collection-descriptor>


Thanks all in advance
Emmanuel



Reply via email to