Please take me out from your mailing list!
I did not subscribe to any of these.


[EMAIL PROTECTED]



--- "Robertson, Jason" <[EMAIL PROTECTED]> wrote:
>If we weren't exchanging messages over email you'd see me doing a little
>victory dance right now! Which, not too surprisingly, makes me glad we're
>exchanging messages over email.
>
>I was using a version of JBoss pulled from CVS in the last day or two, but
>was using examples and docs that applied to the alpha release. Right before
>your email I had decided that JBoss was completely ignoring everything I had
>in my jbosscmp-jdbc.xml file - which it was, because I was using the old
>style where <foreign-key-mapping> and <table-mapping> wrapped the roles. 
>
>Who would have thought to go look at the DTD? I mean, it's only the exact
>description of how I should be formatting the config file. Sigh...
>
>Thanks for kicking me in the right direction, everything works wonderfully
>now.
>
>Jason
>
>-----Original Message-----
>From: Dain Sundstrom [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, February 21, 2002 3:48 PM
>To: Robertson, Jason
>Cc: JBoss User (E-mail)
>Subject: Re: [JBoss-user] CMP2.0 Foreign Key (?) Problem
>
>
>This is definitely a job for the jbosscmp-jdbc.xml file.  What version 
>of JBoss are you using?  The structure of this file changed between the 
>alpha and the beta.  The xml for the classic Order-LineItem in JBoss 3.0 
>beta follows:
>
><ejb-relation>
>    <ejb-relation-name>Order-LineItem</ejb-relation-name>
>    <foreign-key-mapping/>
>    <ejb-relationship-role>
><ejb-relationship-role-name>order.getLineitems()</ejb-relationship-role-name
>>
>       <key-fields>
>          <key-field>
>             <field-name>ordernumber</field-name>
>             <column-name>ORDER_NUMBER</column-name>
>          </key-field>
>       </key-fields>
>    </ejb-relationship-role>
>    <ejb-relationship-role>
><ejb-relationship-role-name>lineitem.getOrder()</ejb-relationship-role-name>
>       <key-fields/>
>    </ejb-relationship-role>
></ejb-relation>
>
>As you can see the roles have been moved out of the foreign-key-mapping 
>element and keys are always specified in terms of the current entity 
>which is backwards from the old foreign key mapping but exactly the same 
>as the table-mapping.  Read the dtd for more info.
>
>-dain
>
>
>Robertson, Jason wrote:
>
>> I have two prebuilt tables that look like this:
>> 
>> mysql> select * from organizationtype;
>> +-------+---------------+
>> | name  | description   |
>> +-------+---------------+
>> | type1 | orgtype-desc1 |
>> | type2 | orgtype-desc2 |
>> +-------+---------------+
>> 2 rows in set (0.00 sec)
>> 
>> mysql> select * from role;
>> +-------+-------------+-------------+
>> | name  | description | orgTypeName |
>> +-------+-------------+-------------+
>> | role1 | role-desc1  | type1       |
>> | role2 | role-desc2  | type1       |
>> | role3 | role-desc3  | type1       |
>> | role4 | role-desc4  | type2       |
>> +-------+-------------+-------------+
>> 4 rows in set (0.00 sec)
>> 
>> Where role->orgTypeName is a foreign key to organizationtype->name.
>> 
>> I was an accessor RoleEntity.getOrganizationType() to return an
>> OrganizationTypeEntity. When I set the relationship up in ejb-jar.xml, the
>> SQL is generated with a field name of organizationType where I need it to
>be
>> orgTypeName. It's my understanding that this is a job for
>> foreign-key-mapping in jbosscmp-jdbc.xml, but I can't get it to work. Is
>> this the proper place to do this mapping? What is the correct
>configuration?
>> 
>> Here's a template, and no matter what I stick in for the '???' areas, I
>> can't seem to ever get orgTypeName into the SQL query:
>> 
>>   <relationships>
>>     <ejb-relation>
>>       <ejb-relation-name>Role-OrganizationType</ejb-relation-name>
>> 
>>       <foreign-key-mapping>
>> 
>>         <ejb-relationship-role>
>>           <ejb-relationship-role-name>
>>             Role-Spawns-OrgType
>>           </ejb-relationship-role-name>
>>           <foreign-key-fields>
>>             <foreign-key-field>
>>               <field-name>???</field-name>
>>               <column-name>???</column-name>
>>             </foreign-key-field>
>>           </foreign-key-fields>
>>         </ejb-relationship-role>
>> 
>>         <ejb-relationship-role>
>>           <ejb-relationship-role-name>
>>              OrgType-Fulfills-Role
>>           </ejb-relationship-role-name>
>>           <foreign-key-fields>
>>             <foreign-key-field>
>>               <field-name>???</field-name>
>>               <column-name>???</column-name>
>>             </foreign-key-field>
>>           </foreign-key-fields>
>>         </ejb-relationship-role>
>> 
>>       </foreign-key-mapping>
>> 
>>      </ejb-relation>
>>    </relationships>
>> 
>> I've "solved" this problem by renaming my column "organizationType" in my
>> database, but I'd still like to understand how to set this up for the
>> example given above.
>> 
>> Thanks,
>> Jason
>> 
>> 
>> 
>> 
>> _______________________________________________
>> JBoss-user mailing list
>> [EMAIL PROTECTED]
>> https://lists.sourceforge.net/lists/listinfo/jboss-user
>> 
>
>
>
>_______________________________________________
>JBoss-user mailing list
>[EMAIL PROTECTED]
>https://lists.sourceforge.net/lists/listinfo/jboss-user

_____________________________________________________________
Get your FREE 6MB web-based e-mail @ 1800-Mail.com
A FREE service by  WIZIW.COM 
Powered by one of the fastest e-mail engines, EveryOneNet.
UserID : YourName @ 1800-Mail.com

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to