Dear sir

I am using jboss-3.2.2RC1_tomcat-4.1.24 backed by MySql.

I have an EJB 2.0 Entity bean in which I defined One-to-One relationship
Between Manufacturer and Contact. In the Manufacturer table I keep the
foreign key of the Contact and here I have a CMR field called contact
that is mapped to the CONTACT_ID database field in the MANUFACTURER
database table
In the Contact Bean there is no CMR field referring to the Manufacturer
(neither is A database field in the CONTACT database table referring to
the MANUFACTURER table) 
Now I see that in my insert SQL statement for the Contact Bean there is
an extra field generated (which of course is not there in the DB table)
for that Manufacturer.
I added the XML elements of the relationship.
How must I correctly write these in order not to have the extra fields
in the insert clause? Or must I always have keys in both parts of the
relation (left and right) although I read in the JBossCMP doc that this
was not necessary.
Many grateful thanks for any suggestion.

Here is the XML entry from the ejb-jar XML file
===============================================
        <ejb-relation>
            <ejb-relation-name>manufacturer-contact</ejb-relation-name>
            <ejb-relationship-role>
                <description>manufacturer</description>
 
<ejb-relationship-role-name>ManufacturerRelationshipRole</ejb-relationsh
ip-role-name>
                <multiplicity>One</multiplicity>
                <relationship-role-source>
                    <description>manufacturer</description>
                    <ejb-name>Manufacturer</ejb-name>
                </relationship-role-source>
                <cmr-field>
                    <description>contact</description>
                    <cmr-field-name>contact</cmr-field-name>
                </cmr-field>
            </ejb-relationship-role>
            <ejb-relationship-role>
                <description>contact</description>
 
<ejb-relationship-role-name>ContactRelationshipRole</ejb-relationship-ro
le-name>
                <multiplicity>One</multiplicity>
                <relationship-role-source>
                    <description>contact</description>
                    <ejb-name>Contact</ejb-name>
                </relationship-role-source>
            </ejb-relationship-role>
        </ejb-relation>


And this is the the entry from the jbosscmp-jdbc.xml file
=========================================================
        <ejb-relation>
            <ejb-relation-name>manufacturer-contact</ejb-relation-name>
            <foreign-key-mapping />
            <ejb-relationship-role>
 
<ejb-relationship-role-name>ManufacturerRelationshipRole</ejb-relationsh
ip-role-name>
                <ejb-designer-id>Manufacturer</ejb-designer-id>
            </ejb-relationship-role>
            <ejb-relationship-role>
 
<ejb-relationship-role-name>ContactRelationshipRole</ejb-relationship-ro
le-name>
                <key-fields>
                    <key-field>
                        <field-name>contactId</field-name>
                        <column-name>CONTACT_ID</column-name>
                    </key-field>
                </key-fields>
 
<datasource>java:/ContactInformationManagementDataSource</datasource>
                <datasource-mapping>mySQL</datasource-mapping>
                <create-table>false</create-table>
                <remove-table>false</remove-table>
                <pk-constraint>true</pk-constraint>
                <fk-constraint>true</fk-constraint>
            </ejb-relationship-role>
        </ejb-relation>
        <ejb-relation>




-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to