I'll answer my own question for other's benefit.

The jbosscmp-jdbc.xml should look like:

        <ejb-relation>
                <ejb-relation-name>UserProfile-Group</ejb-relation-name>
        <relation-table-mapping>
            <table-name>USERPROFILE_USERGROUP</table-name>
        </relation-table-mapping>
                <ejb-relationship-role>
        
<ejb-relationship-role-name>userprofile-belongstoa-group</ejb-relationship-r
ole-name>
            <key-fields>
                <key-field>
                    <field-name>userProfileID</field-name>
                    <column-name>USERPROFILE</column-name>
                </key-field>
            </key-fields>
                </ejb-relationship-role>
                <ejb-relationship-role>
        
<ejb-relationship-role-name>group-hasa-userprofile</ejb-relationship-role-na
me>
            <key-fields>
                <key-field>
                    <field-name>userGroupID</field-name>
                    <column-name>USERGROUP</column-name>
                </key-field>
            </key-fields>
                </ejb-relationship-role>
        </ejb-relation>

-----Original Message-----
From: Craven, Jason [mailto:[EMAIL PROTECTED]]
Sent: Sunday, June 09, 2002 10:46 AM
To: '[EMAIL PROTECTED]'
Subject: [JBoss-user] Relation Table Mapping Question


I want to map to an existing relation table with a CMR.  I have no problem
getting it to map to the correct table.  However, I can't seem to figure out
how to specify the table column names for the primary key fields.  I would
assume it is somewhere in the jbosscmp-jdbc.xml, but can't seem to find it
anywhere in the dtd or elsewhere.

Here's the relation from my jbosscmp-jdbc.xml file:

        <ejb-relation>
                <ejb-relation-name>UserProfile-Group</ejb-relation-name>
        <relation-table-mapping>
            <table-name>USERPROFILE_USERGROUP</table-name>
        </relation-table-mapping>
        </ejb-relation>

and the relation in the ejb-jar.xml:

        <ejb-relation>
                <ejb-relation-name>UserProfile-Group</ejb-relation-name>
                <ejb-relationship-role>
        
<ejb-relationship-role-name>userprofile-belongstoa-group</ejb-relationship-r
ole-name>
                        <multiplicity>Many</multiplicity>
                        <relationship-role-source>
                                <ejb-name>UserProfileEJB</ejb-name>
                        </relationship-role-source>
                        <cmr-field>
                                <cmr-field-name>userGroups</cmr-field-name>
        
<cmr-field-type>java.util.Collection</cmr-field-type>
                        </cmr-field>
                </ejb-relationship-role>
                <ejb-relationship-role>
        
<ejb-relationship-role-name>group-hasa-userprofile</ejb-relationship-role-na
me>
                        <multiplicity>Many</multiplicity>
                        <relationship-role-source>
                                <ejb-name>UserGroupEJB</ejb-name>
                        </relationship-role-source>
                </ejb-relationship-role>
        </ejb-relation>

The create statement for the table looks like this:

CREATE TABLE USERPROFILE_USERGROUP (
       usergroup            NUMBER(19) NULL,
       userprofile          VARCHAR2(30) NULL
);


Like I said, it hits the table, but I get the following problem from the
server.log:

2002-06-09 10:25:14,926 DEBUG
[org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadRelationCommand.UserProfileEJB]
Executing SQL: SELECT UserGroupEJB FROM USERPROFILE_USERGROUP WHERE
(UserProfileEJB=?)
2002-06-09 10:25:15,036 ERROR [org.jboss.ejb.plugins.LogInterceptor]
TransactionRolledbackException, causedBy:
java.sql.SQLException: ORA-00904: invalid column name

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -
http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

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

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - 
http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

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

Reply via email to