Hello,

comments below.

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Hanson, Matthew
> Sent: Monday, January 05, 2004 4:41 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [JBoss-user] 1:1 Unidirectional (Aggregate) 
> Relationship Prob lem
> 
> Hi,
> 
> Hadn't gotten a response, so I thought I would try again...  
> Really looking to get this type of 1:1 relationship pinned 
> down, as it would complete a bunch of the schema stuff of the app...
> 
> Thanks!
> Matt Hanson
> 
> -----Original Message-----
> From: Hanson, Matthew [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 30, 2003 7:17 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [JBoss-user] 1:1 Unidirectional (Aggregate) 
> Relationship Prob lem
> 
> 
> Is id (from <field-name/>) a field belonging to B or A?

A

  Is 
> the a_fk (from
> <column-name/>) column from B or A?

This is a foreign key column referencing A.id in the table entity B is
mapped to.

>  What if the columns and 
> fields from B bean are totally different from A (i.e., 
> B.weird_column_name with
> B.getWeirdColumnName() maps to A.a_primary_key and 
> a.getMyKey())?  What would the resulting jbosscmp-jdbc.xml look like?

Just specify the foreign key column name as it is shown in the example
(a_fk). This column will reference the primary key column in the table A
is mapped to. Referencing other than primary key unique column in A's
table is not supported.

> 
> I think I have been able to set up the type of relationship 
> you mention below.  However, it only seems to work if the 
> primary key from B is found in A with the same column name 
> for both tables.  This isn't exactly what I am hoping to do.
> 
> In my case, the primary key from B is simply not relevent to 
> A, and B contains a non-primary-key field linking it to A.

If it references A's primary key, it is a mapping issue. It should work.

> 
> Does this now make sense?
> 
> -----Original Message-----
> From: Alexey Loubyansky [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 30, 2003 1:56 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [JBoss-user] 1:1 Unidirectional (Aggregate) 
> Relationship Problem
> 
> 
>  Here is an example for 1:1 unidirectional relationship from B to A:
> In B:
>    /**
>     * @ejb.relation
>     *    name="A-B"
>     *    role-name="B-has-A"
>     *    target-ejb="A"
>     *    target-role-name="A-belongsto-B"
>     *    target-multiple="false"
>     * @jboss.relation
>     *    related-pk-field="id"
>     *    fk-column="a_fk"
>     * @ejb.interface-method
>     */
>    public abstract ALocal getA();
>    /**
>    * @ejb.interface-method
>    */
>    public abstract void setA(ALocal value); 
> 
> Resulting DDs:
> 
> ejb-jar.xml:
>       <ejb-relation >
>          <ejb-relation-name>A-B</ejb-relation-name>
> 
>          <ejb-relationship-role >
>             
> <ejb-relationship-role-name>B-has-A</ejb-relationship-role-name>
>             <multiplicity>One</multiplicity>
>             <relationship-role-source >
>                <ejb-name>B</ejb-name>
>             </relationship-role-source>
>             <cmr-field >
>                <cmr-field-name>a</cmr-field-name>
>             </cmr-field>
>          </ejb-relationship-role>
> 
>          <ejb-relationship-role >
>  
> <ejb-relationship-role-name>A-belongsto-B</ejb-relationship-role-name>
>             <multiplicity>One</multiplicity>
>             <relationship-role-source >
>                <ejb-name>A</ejb-name>
>             </relationship-role-source>
>          </ejb-relationship-role>
> 
>       </ejb-relation>
> 
> jbosscmp-jdbc.xml:
>     <ejb-relation>
>       <ejb-relation-name>A-B</ejb-relation-name>
> 
>       <ejb-relationship-role>
>           
> <ejb-relationship-role-name>B-has-A</ejb-relationship-role-name>
>                 <key-fields/>
> 
>       </ejb-relationship-role>
>       <ejb-relationship-role>
>  
> <ejb-relationship-role-name>A-belongsto-B</ejb-relationship-role-name>
>           <key-fields>
>              <key-field>
>                <field-name>id</field-name>
>                <column-name>a_fk</column-name>
>              </key-field>
>           </key-fields>
> 
>       </ejb-relationship-role>
>     </ejb-relation>
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: IBM Linux Tutorials.
> Become an expert in LINUX or just sharpen your skills.  Sign 
> up for IBM's Free Linux Tutorials.  Learn everything from the 
> bash shell to sys admin.
> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: IBM Linux Tutorials.
> Become an expert in LINUX or just sharpen your skills.  Sign 
> up for IBM's Free Linux Tutorials.  Learn everything from the 
> bash shell to sys admin.
> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: IBM Linux Tutorials.
> Become an expert in LINUX or just sharpen your skills.  Sign 
> up for IBM's Free Linux Tutorials.  Learn everything from the 
> bash shell to sys admin.
> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> 


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to