Apache JDO Project - Question about orm metadata for inheritance

This is Interesting: Free IT Magazines  
Home > Archive > Apache JDO Project > July 2005 > Question about orm metadata for inheritance





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Question about orm metadata for inheritance
Michael Watzek

2005-07-26, 7:45 am

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

erik@jpox.org

2005-07-26, 7:45 am

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 <mwa.tech@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

2005-07-26, 7:45 am

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 <mwa.tech@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/
-------------------------------------------------------------------

erik@jpox.org

2005-07-26, 7:45 am

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 <mwa.tech@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 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/
> -------------------------------------------------------------------
>





Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com