i have two classes Computer and Flowers which derive from class Product.
In class Product i've implemented interface Persistent to return the right
class to load from method jdoLoad.
i want to group products (Computers and Flowers) in class ProductGroup.
Computers and Flowers will be stored fine.
but when i load the ProductGroup i get only Product objects instead of
Computer and Flowers objects.
how do i get the right objects back from ProductGroup ?
and another question with same background:
how do i select all Products (both Computers and Flowers) in OQL ?
the only thing which works is "SELECT p FROM Product p" but i get only
Products, not the concrete classes Computer and Flowers.
the mapping for my classes are below.
<mapping>
<class name="ProductGroup" identity="id" auto-store="true"
cache-type="none">
<description></description>
<map-to table="RXS_EX_PRODUCTGROUP"/>
<field name="id" type="string" direct="true" required="true">
<sql name="PG_ID" type="varchar"/>
</field>
<field name="name" type="string" direct="true" required="true">
<sql name="NAME" type="varchar"/>
</field>
</class>
<class name="Product" identity="id">
<description></description>
<map-to table="RXS_EX_PRODUCT"/>
<field name="id" type="string" direct="true" required="true">
<sql name="P_ID" type="varchar"/>
</field>
<field name="name" type="string" direct="true" required="true">
<sql name="NAME" type="varchar"/>
</field>
<field name="productGroup" type="string" direct="true" required="true">
<sql name="PG_ID"/>
</field>
<field name="className" type="string" direct="true" required="true">
<sql name="CLASS" type="varchar"/>
</field>
<field name="price" type="float" direct="true" required="true">
<sql name="price" type="numeric" />
</field>
</class>
<class name="Computer" identity="id" extends="Product">
<description></description>
<map-to table="RXS_EX_COMPUTER"/>
<field name="id" type="string" direct="true" required="true">
<sql name="P_ID" type="varchar"/>
</field>
<field name="cpu" type="string" direct="true" required="true">
<sql name="CPU" type="varchar"/>
</field>
</class>
<class name="Flowers" identity="id" extends="Product">
<description></description>
<map-to table="RXS_EX_FLOWERS"/>
<field name="id" type="string" direct="true" required="true">
<sql name="P_ID" type="varchar"/>
</field>
<field name="pieces" type="integer" direct="true" required="true">
<sql name="PIECES" type="integer"/>
</field>
</class>
</mapping>
regards,
lars
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev