It worked out setting the collection-class to ManageableVector
Thank you all. ----- Original Message ----- From: "sclark" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, September 25, 2003 12:08 PM Subject: Re: problem with n:m collection > This is because the default behavior was recently changed; collections now use > RemovalAwareCollection by default, which has the effect of deleting the > contained object as well as the relationship. The fix is to specify a different > ManageableCollection implementation in the collection-class attribute of your > collection-descriptor. > > Because this surprising and fundamental change in behavior has been made at such > a late date (RC3 or 4?), it seems that it should be noted in the release notes > and perhaps added to the FAQ. > > -steve > > Steve Clark > Technology Applications Team > Natural Resources Research Center/USGS > [EMAIL PROTECTED] > (970)226-9291 ----- Original Message ----- From: "R�da Benzair" <[EMAIL PROTECTED]> To: "'OJB Users List'" <[EMAIL PROTECTED]> Sent: Thursday, September 25, 2003 12:34 PM Subject: RE: problem with n:m collection > Hi > can be it is a solution with you to see > Add in Class-descriptor > collection-class="org.apache.ojb.broker.util.collections.ManageableVecto > r" > > > -----Original Message----- > From: Mart�n Capriotti APTIX [mailto:[EMAIL PROTECTED] > Sent: jeudi 25 septembre 2003 17:02 > To: [EMAIL PROTECTED] > Subject: problem with n:m collection > > 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. > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
