Harris,

  That extra table IS necessary.  That is the way that ALL relationships
are managed by the ejb container.

myParent
--------------
myParentPK
myParentData1
myParentData2

myChild
--------------
myChildPK
myChildData1

Relationship: Parent has Children Containment (1 -> N Bi-directional)

myParent_myChild
----------------
myParentPK
myChildPK

This allows trivial bi-directionality in a 1 -> N, even if it's
uni-directional, the same construct can be used.  In the case of
bi-directional 1 -> N the table is in fact necessary as there's no way,
except perhaps to use a Collection of myChildPK's attribute in myParent,
to back reference the myChild relationships from the myParent object.

- Scot

Harris Simon wrote:
> 
> I am trying to get a bi-directional container managed relationship working
> in Orion 1.5.2 but it keeps creating an intermediate table. Is there anyway
> to stop this? There is no need for the extra table.
> 
> Here is my example:
> 
> Change[1]----->[*]Objection
> 
> create table change (
>         change_id integer primary key
> )
> 
> create table objection (
>         objection_id integer primary key,
>         change_id integer
> )
> 
> <ejb-relation>
>         <ejb-relation-name>Change-Objection</ejb-relation-name>
>         <ejb-relationship-role>
> 
> <ejb-relationship-role-name>change-has-objections</ejb-relationship-role-nam
> e>
>                 <multiplicity>One</multiplicity>
>                 <role-source>
>                         <ejb-name>Change</ejb-name>
>                 </role-source>
>                 <cmr-field>
>                         <cmr-field-name>objections</cmr-field-name>
>                         <cmr-field-type>java.util.Set</cmr-field-type>
>                 </cmr-field>
>         </ejb-relationship-role>
>         <ejb-relationship-role>
> 
> <ejb-relationship-role-name>objection-belongsto-change</ejb-relationship-rol
> e-name>
>                 <multiplicity>Many</multiplicity>
>                 <cascade-delete/>
>                 <role-source>
>                         <ejb-name>Objection</ejb-name>
>                 </role-source>
>                 <cmr-field>
>                         <cmr-field-name>change</cmr-field-name>
>                 </cmr-field>
>         </ejb-relationship-role>
> </ejb-relation>
> 
> ******************************************************************
> This e-mail is confidential and for the sole use of the intended
> recipient(s).  If you are not the intended recipient, you are not
> authorised to disclose, use, distribute or in any other way make
> use of the information contained in it, and such activities are
> prohibited.  If you have received this e-mail in error, please
> notify the sender by reply e-mail, delete the document and destroy
> all copies of the original message.
> ******************************************************************

-- 

  scot weber - [EMAIL PROTECTED]
  -------------
  Given a choice between a folly and a sacrament, one should
  always choose the folly -- because we know a sacrament
  will not bring us closer to God and there's always a chance
  that a folly will. - Erasmus

  The only man who never makes a mistake is the man who
  never does anything. - Theodore Roosevelt.

Reply via email to