Thanks for your kind support.

Here is the insert SQL
INSERT INTO CONTACT (CONTACT_ID, NAME, ADDRESS, TEL1, TEL2, TEL3, GSM, FAX, EMAIL, URL, IBAN_CODE, BIC, COMMENTS, CREATION_DATE, LOCALITY_ID, Manufacturer_contact) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)


And yes it deploys correctly without errors.
Could you give me a hint on what and how to change the XML file to make it compliant?
An example of a One-To-One relation with only <key-fields> on one side would be extra super.
Many many thanks.


I can even define the an <cmr-field> element in the <ejb-relationship-role> element that has no <key-fields> element in the jbosscmp-jdbc.xml file

Like this:
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-relationship-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-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source>
<description>contact</description>
<ejb-name>Contact</ejb-name>
</relationship-role-source>
<cmr-field>
<description> manufacturer </description>
<cmr-field-name> manufacturer </cmr-field-name>
</cmr-field>
</ejb-relationship-role>
</ejb-relation>



The the insert SQL changes to
INSERT INTO CONTACT (CONTACT_ID, NAME, ADDRESS, TEL1, TEL2, TEL3, GSM, FAX, EMAIL, URL, IBAN_CODE, BIC, COMMENTS, CREATION_DATE, LOCALITY_ID, manufacturer) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)



From: Alexey Loubyansky <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Spurious fields in the SQL Insert of a EJB 2.0 bean with One-to-One relations
Date: Tue, 11 Nov 2003 21:16:27 +0200


What is the SQL query generated?

Your configuration does not match the DTD. Which is
<!ELEMENT ejb-relationship-role (ejb-relationship-role-name,
         fk-constraint?, key-fields?, read-ahead?)>

Is it deployed w/o errors?

[EMAIL PROTECTED] wrote:

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





-------------------------------------------------------
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

_________________________________________________________________





------------------------------------------------------- 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