Please take me out from your mailing list! I did not subscribe to any of these.
[EMAIL PROTECTED] --- Dain Sundstrom <[EMAIL PROTECTED]> wrote: >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