Hi everyone, here is my problem with m:n non-decomposed associations
I have to classes Actor and Role,
the problem is that when I try to persist the m:n relation the
indirection-table doesn't get populated
I've looked in the Logs and something interesting was happening.....
After inserting an actor or Role, OJB is issuing a DELETE !!!
here is my code and mapping info....
Help appreciated....
Comments:
String ObjectLookup is an extention from ManageableCollection........
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeInsert
: [EMAIL PROTECTED]
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeInsert:
[EMAIL PROTECTED]: INSERT INTO
organization_role (oid,name,description,unit_id) VALUES
(581,'Anyone',null,[EMAIL PROTECTED]
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG:
executeUpdateSQL: DELETE FROM organization_actorRole WHERE mRole_id=?
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeInsert
: [EMAIL PROTECTED]
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeInsert:
[EMAIL PROTECTED]: INSERT INTO
organization_actor (oid,name,password,mIsActive,actorManager_id) VALUES
(582,'saman',null,'0',[EMAIL PROTECTED]
[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG:
executeUpdateSQL: DELETE FROM organization_actorRole WHERE mActor_id=?
------------------------------------------------------------------------
-----
<class-descriptor
class="com.met.boma.organization.Actor"
table="organization_actor">
<collection-descriptor
name="mRoles"
element-class-ref="com.met.boma.organization.Role"
indirection-table="organization_actorRole"
collection-class="com.met.boma.generic.StringObjectLookup"
>
<fk-pointing-to-this-class column="mActor_id"/>
<fk-pointing-to-element-class column="mRole_id"/>
</collection-descriptor>
>
<class-descriptor
class="com.met.boma.organization.Role"
table="organization_role"
>
<collection-descriptor
name="mActors"
element-class-ref="com.met.boma.organization.Actor"
indirection-table="organization_actorRole"
collection-class="com.met.boma.generic.StringObjectLookup"
>
<fk-pointing-to-this-class column="mRole_id"/>
<fk-pointing-to-element-class column="mActor_id"/>
</collection-descriptor>
>
------------------------------------------------------------------------
-----
Actor actor = new Actor();
actor.setName("Actor");
Role role = new Role();
role.setName("Anyone");
role.putActor(actor);
actor.putRole(role);
broker.store(actor);
broker.store(role);
Saman Ghodsian
CTO
Middle Earth Technologies Ltd.
www.metca.com
Cell (604)-839-7791
Vancouver, BC
Canada
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]