Hi
I have problems with n:m mappings, it is deleting the referenced objets instead of 
deleting only the reference (when I delete it from the collection)
(behaving as if  auto-delete="true" is set)


Example:
one way n:m direct mapping from Roles to Usuario (nothing mapped from Usuario to Rol)

-------------------- MAPPING OF COLLECTION usuarios IN CLASS Rol 
----------------------------------
<class-descriptor ... Rol...>
...
<collection-descriptor
 name="usuarios"
 element-class-ref="net.aptix.intranet.seguridad.Usuario"
 indirection-table="ROLES_USR" >
   <fk-pointing-to-this-class column="ID_ROL"/>
   <fk-pointing-to-element-class column="ID_USR"/>

</collection-descriptor> 

-------------class Rol----------------------


.....

public Collection usuarios = new Vector();

.....

public Collection getUsuarios() {

return usuarios;

}

public void setUsuarios(Collection _usuarios){

this.usuarios=_usuarios;

}

-----------------------------------

This example should remove one Usuario (id=5) from a Rol (id=10):

Rol r=Rol.getRolById(10);

Usuario u= Usuario.getUsuariobyId(5);

r.getUsuarios.remove(u);

store...

----------------------------------------------------------------------

It does the work.. and more: It removes Usuario "u" from the collection as it should, 
but it also removes that object Usuario (id=5) from DB, as if  auto-delete="true" has 
been set!

It seems this problem started when we moved from OJB 0.97 to 1RC4

Thanks , Mart�n.


Reply via email to