You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by Michael Watzek <mw...@spree.de> on 2005/07/26 12:15:46 UTC

Question about orm metadata for inheritance

Hi Craig, Andy, Erik,

I'm testing a kind of inheritance mapping using strategy "new-table" 
where each table contains columns for all fields. Thus, a table of a 
subclass contains columns for the declared fields *and* for the fields 
of all superclasses, e.g. this is the orm metadata of classes 
"Insurance" and "DentalInsurance":

<orm>
     <package name="org.apache.jdo.tck.pc.company">
         ...
         <class name="Insurance" table="insuranceplans">
             <inheritance strategy="new-table"/>
             <field name="insid" column="INSID" primary-key="true"/>
             <field name="carrier" column="CARRIER"/>
             <field name="employee" column="EMPLOYEE">
                  <foreign-key/>
             </field>
         </class>

         <class name="DentalInsurance" table="dentalinsurance">
             <inheritance strategy="new-table">
                 <join column="INSID"/>
             </inheritance>
             <field name="insid" column="INSID" primary-key="true"/>
             <field name="carrier" column="CARRIER"/>
             <field name="employee" column="EMPLOYEE">
                  <foreign-key/>
             </field>
             <field name="lifetimeOrthoBenefit" 
column="LIFETIME_ORTHO_BENEFIT"/>
         </class>
         ...
     </package>
</orm>

The Completeness test throws an exception applying this mapping 
("org.jpox.metadata.InvalidMetaDataException: Class 
org.apache.jdo.tck.pc.company.DentalInsurance has field 
org.apache.jdo.tck.pc.company.DentalInsurance.carrier declared in 
MetaData, but this field doesnt exist in the class!").

My question: Is this a valid mapping, if fields of superclasses are 
repeated in the orm metadata of subclasses?

Regards,
Michael
-- 
-------------------------------------------------------------------
Michael Watzek                  Tech@Spree Engineering GmbH
mailto:mwa.tech@spree.de        Buelowstr. 66
Tel.:  ++49/30/235 520 36       10783 Berlin - Germany
Fax.:  ++49/30/217 520 12       http://www.spree.de/
-------------------------------------------------------------------

Re: Question about orm metadata for inheritance

Posted by er...@jpox.org.
Michael,

We dont support "Insurance.insid" (SuperclassName.fieldName).

On a related issue, we also dont support fetch plans/indexes declared with
SuperclassName.fieldName, fieldName#key, fieldName#value or fieldName#element.

Regards,

Erik Bengtson

Quoting Michael Watzek <mw...@spree.de>:

> Hi Erik,
>
> I'm just curious. Can you explain in more detail which parts of the orm
> metadata JPOX does not support right now? Is it inheritance strategy
> "new-table" in conjunction with a <join> element, or the repitition of
> superclass fields in subclasses?
>
> Regards,
> Michael
>
> > Michael,
> >
> > No it is not valid. The below is valid, I think.
> >
> > <field name="Insurance.insid" column="INSID" primary-key="true"/>
> > <field name="Insurance.carrier" column="CARRIER"/>
> > <field name="Insurance.employee" column="EMPLOYEE">
> >     <foreign-key/>
> > </field>
> >
> > JPOX does not support the above syntax, yet.
> >
> > Regards,
> >
> > Erik Bengtson
> >
> > Quoting Michael Watzek <mw...@spree.de>:
> >
> >
> >>Hi Craig, Andy, Erik,
> >>
> >>I'm testing a kind of inheritance mapping using strategy "new-table"
> >>where each table contains columns for all fields. Thus, a table of a
> >>subclass contains columns for the declared fields *and* for the fields
> >>of all superclasses, e.g. this is the orm metadata of classes
> >>"Insurance" and "DentalInsurance":
> >>
> >><orm>
> >>     <package name="org.apache.jdo.tck.pc.company">
> >>         ...
> >>         <class name="Insurance" table="insuranceplans">
> >>             <inheritance strategy="new-table"/>
> >>             <field name="insid" column="INSID" primary-key="true"/>
> >>             <field name="carrier" column="CARRIER"/>
> >>             <field name="employee" column="EMPLOYEE">
> >>                  <foreign-key/>
> >>             </field>
> >>         </class>
> >>
> >>         <class name="DentalInsurance" table="dentalinsurance">
> >>             <inheritance strategy="new-table">
> >>                 <join column="INSID"/>
> >>             </inheritance>
> >>             <field name="insid" column="INSID" primary-key="true"/>
> >>             <field name="carrier" column="CARRIER"/>
> >>             <field name="employee" column="EMPLOYEE">
> >>                  <foreign-key/>
> >>             </field>
> >>             <field name="lifetimeOrthoBenefit"
> >>column="LIFETIME_ORTHO_BENEFIT"/>
> >>         </class>
> >>         ...
> >>     </package>
> >></orm>
> >>
> >>The Completeness test throws an exception applying this mapping
> >>("org.jpox.metadata.InvalidMetaDataException: Class
> >>org.apache.jdo.tck.pc.company.DentalInsurance has field
> >>org.apache.jdo.tck.pc.company.DentalInsurance.carrier declared in
> >>MetaData, but this field doesnt exist in the class!").
> >>
> >>My question: Is this a valid mapping, if fields of superclasses are
> >>repeated in the orm metadata of subclasses?
> >>
> >>Regards,
> >>Michael
> >>--
> >>-------------------------------------------------------------------
> >>Michael Watzek                  Tech@Spree Engineering GmbH
> >>mailto:mwa.tech@spree.de        Buelowstr. 66
> >>Tel.:  ++49/30/235 520 36       10783 Berlin - Germany
> >>Fax.:  ++49/30/217 520 12       http://www.spree.de/
> >>-------------------------------------------------------------------
> >>
> >
> >
> >
>
>
> --
> -------------------------------------------------------------------
> Michael Watzek                  Tech@Spree Engineering GmbH
> mailto:mwa.tech@spree.de        Buelowstr. 66
> Tel.:  ++49/30/235 520 36       10783 Berlin - Germany
> Fax.:  ++49/30/217 520 12       http://www.spree.de/
> -------------------------------------------------------------------
>




Re: Question about orm metadata for inheritance

Posted by Michael Watzek <mw...@spree.de>.
Hi Erik,

I'm just curious. Can you explain in more detail which parts of the orm 
metadata JPOX does not support right now? Is it inheritance strategy 
"new-table" in conjunction with a <join> element, or the repitition of 
superclass fields in subclasses?

Regards,
Michael

> Michael,
> 
> No it is not valid. The below is valid, I think.
> 
> <field name="Insurance.insid" column="INSID" primary-key="true"/>
> <field name="Insurance.carrier" column="CARRIER"/>
> <field name="Insurance.employee" column="EMPLOYEE">
>     <foreign-key/>
> </field>
> 
> JPOX does not support the above syntax, yet.
> 
> Regards,
> 
> Erik Bengtson
> 
> Quoting Michael Watzek <mw...@spree.de>:
> 
> 
>>Hi Craig, Andy, Erik,
>>
>>I'm testing a kind of inheritance mapping using strategy "new-table"
>>where each table contains columns for all fields. Thus, a table of a
>>subclass contains columns for the declared fields *and* for the fields
>>of all superclasses, e.g. this is the orm metadata of classes
>>"Insurance" and "DentalInsurance":
>>
>><orm>
>>     <package name="org.apache.jdo.tck.pc.company">
>>         ...
>>         <class name="Insurance" table="insuranceplans">
>>             <inheritance strategy="new-table"/>
>>             <field name="insid" column="INSID" primary-key="true"/>
>>             <field name="carrier" column="CARRIER"/>
>>             <field name="employee" column="EMPLOYEE">
>>                  <foreign-key/>
>>             </field>
>>         </class>
>>
>>         <class name="DentalInsurance" table="dentalinsurance">
>>             <inheritance strategy="new-table">
>>                 <join column="INSID"/>
>>             </inheritance>
>>             <field name="insid" column="INSID" primary-key="true"/>
>>             <field name="carrier" column="CARRIER"/>
>>             <field name="employee" column="EMPLOYEE">
>>                  <foreign-key/>
>>             </field>
>>             <field name="lifetimeOrthoBenefit"
>>column="LIFETIME_ORTHO_BENEFIT"/>
>>         </class>
>>         ...
>>     </package>
>></orm>
>>
>>The Completeness test throws an exception applying this mapping
>>("org.jpox.metadata.InvalidMetaDataException: Class
>>org.apache.jdo.tck.pc.company.DentalInsurance has field
>>org.apache.jdo.tck.pc.company.DentalInsurance.carrier declared in
>>MetaData, but this field doesnt exist in the class!").
>>
>>My question: Is this a valid mapping, if fields of superclasses are
>>repeated in the orm metadata of subclasses?
>>
>>Regards,
>>Michael
>>--
>>-------------------------------------------------------------------
>>Michael Watzek                  Tech@Spree Engineering GmbH
>>mailto:mwa.tech@spree.de        Buelowstr. 66
>>Tel.:  ++49/30/235 520 36       10783 Berlin - Germany
>>Fax.:  ++49/30/217 520 12       http://www.spree.de/
>>-------------------------------------------------------------------
>>
> 
> 
> 


-- 
-------------------------------------------------------------------
Michael Watzek                  Tech@Spree Engineering GmbH
mailto:mwa.tech@spree.de        Buelowstr. 66
Tel.:  ++49/30/235 520 36       10783 Berlin - Germany
Fax.:  ++49/30/217 520 12       http://www.spree.de/
-------------------------------------------------------------------

Re: Question about orm metadata for inheritance

Posted by er...@jpox.org.
Michael,

No it is not valid. The below is valid, I think.

<field name="Insurance.insid" column="INSID" primary-key="true"/>
<field name="Insurance.carrier" column="CARRIER"/>
<field name="Insurance.employee" column="EMPLOYEE">
    <foreign-key/>
</field>

JPOX does not support the above syntax, yet.

Regards,

Erik Bengtson

Quoting Michael Watzek <mw...@spree.de>:

> Hi Craig, Andy, Erik,
>
> I'm testing a kind of inheritance mapping using strategy "new-table"
> where each table contains columns for all fields. Thus, a table of a
> subclass contains columns for the declared fields *and* for the fields
> of all superclasses, e.g. this is the orm metadata of classes
> "Insurance" and "DentalInsurance":
>
> <orm>
>      <package name="org.apache.jdo.tck.pc.company">
>          ...
>          <class name="Insurance" table="insuranceplans">
>              <inheritance strategy="new-table"/>
>              <field name="insid" column="INSID" primary-key="true"/>
>              <field name="carrier" column="CARRIER"/>
>              <field name="employee" column="EMPLOYEE">
>                   <foreign-key/>
>              </field>
>          </class>
>
>          <class name="DentalInsurance" table="dentalinsurance">
>              <inheritance strategy="new-table">
>                  <join column="INSID"/>
>              </inheritance>
>              <field name="insid" column="INSID" primary-key="true"/>
>              <field name="carrier" column="CARRIER"/>
>              <field name="employee" column="EMPLOYEE">
>                   <foreign-key/>
>              </field>
>              <field name="lifetimeOrthoBenefit"
> column="LIFETIME_ORTHO_BENEFIT"/>
>          </class>
>          ...
>      </package>
> </orm>
>
> The Completeness test throws an exception applying this mapping
> ("org.jpox.metadata.InvalidMetaDataException: Class
> org.apache.jdo.tck.pc.company.DentalInsurance has field
> org.apache.jdo.tck.pc.company.DentalInsurance.carrier declared in
> MetaData, but this field doesnt exist in the class!").
>
> My question: Is this a valid mapping, if fields of superclasses are
> repeated in the orm metadata of subclasses?
>
> Regards,
> Michael
> --
> -------------------------------------------------------------------
> Michael Watzek                  Tech@Spree Engineering GmbH
> mailto:mwa.tech@spree.de        Buelowstr. 66
> Tel.:  ++49/30/235 520 36       10783 Berlin - Germany
> Fax.:  ++49/30/217 520 12       http://www.spree.de/
> -------------------------------------------------------------------
>