db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michelle Caisse <Michelle.Cai...@Sun.COM>
Subject equivalent mappings of join condition?
Date Wed, 20 Jul 2005 22:05:07 GMT
Hi,

Are the following mappings equivalent?  They differ in the placement of 
the <join> element.

Mapping 1:
        <class name="Person" table="persons">
            <datastore-identity strategy="identity" 
column="DATASTORE_IDENTITY"/>
            <inheritance strategy="new-table">
                <discriminator strategy="class-name" 
column="DISCRIMINATOR"/>
            </inheritance>
            <join column="EMPID" table="employee_phoneno_type"/>
            <field name="personid" column="PERSONID"/>
            <field name="firstname" column="FIRSTNAME"/>
            <field name="lastname" column="LASTNAME"/>
            <field name="middlename" column="MIDDLENAME"/>
            <field name="address">
                <embedded null-indicator-column="COUNTRY">
                    <field name="addrid" column="ADDRID"/>
                    <field name="street" column="STREET"/>
                    <field name="city" column="CITY"/>
                    <field name="state" column="STATE"/>
                    <field name="zipcode" column="ZIPCODE"/>
                    <field name="country" column="COUNTRY"/>
                </embedded>
            </field>
            <field name="phoneNumbers" table="employee_phoneno_type" >
                <key column="TYPE"/>
                <value column="PHONENO"/>
            </field>
        </class>

Mapping 2:
        <class name="Person" table="persons">
            <datastore-identity strategy="identity" 
column="DATASTORE_IDENTITY"/>
            <inheritance strategy="new-table">
                <discriminator strategy="class-name" 
column="DISCRIMINATOR"/>
            </inheritance>
            <field name="personid" column="PERSONID"/>
            <field name="firstname" column="FIRSTNAME"/>
            <field name="lastname" column="LASTNAME"/>
            <field name="middlename" column="MIDDLENAME"/>
            <field name="address">
                <embedded null-indicator-column="COUNTRY">
                    <field name="addrid" column="ADDRID"/>
                    <field name="street" column="STREET"/>
                    <field name="city" column="CITY"/>
                    <field name="state" column="STATE"/>
                    <field name="zipcode" column="ZIPCODE"/>
                    <field name="country" column="COUNTRY"/>
                </embedded>
            </field>
            <field name="phoneNumbers" table="employee_phoneno_type" >
                <join column="EMPID"/>
                <key column="TYPE"/>
                <value column="PHONENO"/>
            </field>
        </class>

JPOX appears to treat them differently. When mapping 1 is used, an 
apparent attempt to insert values (nulls) into the employee_phoneno_type 
table results in an error: "ERROR 23502: Column 'PHONENO'  cannot accept 
a NULL value".  Mapping 2 executes without error.

-- Michelle

Mime
View raw message