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(); //----------------------------
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE descriptor-repository SYSTEM "repository.dtd" [<!ENTITY database SYSTEM 'repository_database.xml'> ]> <descriptor-repository isolation-level="read-uncommitted" version="1.0"> &database; <class-descriptor class="com.amdm.organisation.model.Login" table="logins"> <field-descriptor autoincrement="true" column="ID" jdbc-type="INTEGER" name="id" primarykey="true"/> <field-descriptor column="login" jdbc-type="VARCHAR" name="login"/> <collection-descriptor auto-delete="false" auto-retrieve="true" auto-update="false" element-class-ref="com.amdm.organisation.model.Role" indirection-table="logins_roles" name="roles"> <fk-pointing-to-this-class column="LOGIN_ID"/> <fk-pointing-to-element-class column="ROLE_ID"/> </collection-descriptor> </class-descriptor> <class-descriptor class="com.amdm.organisation.model.Role" table="roles"> <field-descriptor autoincrement="true" column="ID" jdbc-type="INTEGER" name="id" primarykey="true"/> <field-descriptor column="NAME" jdbc-type="VARCHAR" name="name"/> <collection-descriptor auto-delete="false" auto-retrieve="false" auto-update="false" element-class-ref="com.amdm.organisation.model.Actor" indirection-table="actors_roles" name="actors" otm-dependent="false"> <fk-pointing-to-this-class column="ROLE_ID"/> <fk-pointing-to-element-class column="ACTOR_ID"/> </collection-descriptor> </class-descriptor> <class-descriptor class="com.amdm.organisation.model.Actor" table="Actors"> <field-descriptor sequence-name="actors_id_seq" autoincrement="true" column="ID" jdbc-type="INTEGER" name="id" primarykey="true"/> <field-descriptor column="FIRSTNAME" jdbc-type="VARCHAR" name="firstname"/> <field-descriptor column="LASTNAME" jdbc-type="VARCHAR" name="lastname"/> <field-descriptor column="address_id" jdbc-type="integer" name="addressId"/> <collection-descriptor auto-delete="true" auto-retrieve="true" auto-update="false" element-class-ref="com.amdm.organisation.model.Role" indirection-table="actors_roles" name="roles"> <fk-pointing-to-this-class column="ACTOR_ID"/> <fk-pointing-to-element-class column="ROLE_ID"/> </collection-descriptor> </class-descriptor> <class-descriptor class="com.amdm.organisation.model.Address" table="Addresses"> <field-descriptor autoincrement="true" column="ID" jdbc-type="INTEGER" name="id" primarykey="true"/> <field-descriptor column="address1" jdbc-type="VARCHAR" name="address1"/> <field-descriptor column="address2" jdbc-type="VARCHAR" name="address2"/> <field-descriptor column="zip" jdbc-type="VARCHAR" name="zip"/> <field-descriptor column="city" jdbc-type="VARCHAR" name="city"/> <field-descriptor column="country" jdbc-type="VARCHAR" name="country"/> </class-descriptor> </descriptor-repository>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]