For M:N mappings, you should not use auto-delete (that will remove the M or N side - depending on config/code). You should use 'auto-delete=false' and a 'collection-class=org.apache.ojb.broker.util.RemovalAwareCollection' (I don't remember the complete class name - please, double check it).
This make OJB remove only the "middle" object (not the real objects, only the mapping between them). BUT, after I write all this things (and re-checing your e-mail to see if I missed something), I remembered to alert you that my tip is based on PB Api (that I really use), not ODMG. Someone else more familiarized on ODMG could give you more orientation (or confirm is this solution works with ODMG too). Best regards, Edson Richter > Hi all, > I'm really lost with auto-delete feature... > > The model: > > 0,n 0,n > Actors ------------ Roles > > The RDBMS schema: > > actors ( id, ... ) > roles ( id, ... ) > actors_roles ( actor_id, role_id ) > > The problem: > > With the attached repository.xml, when I remove a role from an actor, > the role is also deleted from the table. But when I remove the actor, > the role is kept ????? > > All attribute are ( auto-update, auto-delete ) set to false. > > ojb-RC5 > > //---------------------------- > > Transaction tx = odmg.newTransaction(); > tx.begin(); > Actor actor = retrieveActor(id); > tx.lock(actor, Transaction.WRITE); > actor.removeRole(0); ( delegate actor.roles.remove(0) on a vector ) > > tx.commit(); > //---------------------------- > > > > > --------------------------------------------------------------------- > 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]
