You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Bart Molenkamp <b....@bizzdesign.nl> on 2005/05/25 10:16:29 UTC

Non-decomposed m:n mappings sharing foreign key fields

Hi all,

I have a problem with m:n mappings. I have a type ProcessImpl, and a
type AccountImpl, and between them there is an m:n relationship. Both
types are children of a type FrameworkImpl. Relations between
ProcessImpl objects and AccountImpl objects are only allowed within the
same FrameworkImpl object (thus they must have the same FrameworkImpl
parent). Therefore, I want to share the FRAMEWORK_ID field in the
indirection table. See the OJB doclet snippet from AccountImpl below:

@ojb.collection element-class-ref="...ProcessImpl"
  collection-class="...ManageableArrayList"
  indirection-table="RM_PROCESS_ACCOUNT"
  foreignkey="FRAMEWORK_ID,ACCOUNT_ID"
  remote-foreignkey="FRAMEWORK_ID,PROCESS_ID"

There is a similair snippet for ProcessImpl, of course.

When I try to create a ProcessImpl and an AccountImpl, and add a
relation between them, the process fails because OJB tries to update the
indirection table where it puts the field FRAMEWORK_ID two times in a
single query (one time for the ProcessImpl reference, one time for the
AccountImpl reference) and this is not allowed by the database.

Is this a bug, or am I doing something wrong here? I think I can fix the
problem by doing the decomposition manually, but I rather let OJB do it
transparently as I don't have to change my domain model then.

Thanks in advance,
Bart.


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org