<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
                          "http://castor.org/mapping.dtd">
<mapping>
  <!--  Mapping for ProductGroup  -->
  <class access="db-locked" name="jdo.c972.ProductGroup" identity="id">
    <description>Product group</description>
    <map-to table="prod_group" xml="group" />
    <field name="id" type="integer" >
      <sql name="id" type="integer"/>
      <bind-xml node="attribute"/>
    </field>
    <field name="name" type="string">
      <sql name="name" type="char" dirty="check" />
      <bind-xml node="text" />
    </field>
  </class>

  <!--  Mapping for Product  -->
  <class access="db-locked" name="jdo.c972.Product" identity="id">
    <description>Product definition</description>
    <map-to table="prod" xml="product" />
    <field name="id" type="integer">
      <sql name="id" type="integer" />
      <bind-xml name="id" node="attribute"/>
    </field>
    <field name="name" type="string">
      <sql name="name" type="char" />
      <bind-xml name="name" node="element" />
    </field>
    <field name="price" type="float">
      <sql name="price" type="numeric" />
      <bind-xml name="price" node="element" />
    </field>
    <!--  Product has reference to ProductGroup, many products may reference same group  -->
    <field name="group" type="jdo.c972.ProductGroup">
      <sql name="group_id" />
      <bind-xml name="group" node="element" />
    </field>
  </class>

  <!--  Mapping for NewProduct  -->
  <class access="db-locked" name="jdo.c972.NewProduct" identity="id">
    <description>Product definition</description>
    <map-to table="newprod" xml="newproduct" />
    <field name="id" type="integer">
      <sql name="id" type="integer" />
      <bind-xml name="id" node="attribute"/>
    </field>
    <field name="name" type="string">
      <sql name="name" type="char" />
      <bind-xml name="name" node="element" />
    </field>
    <field name="price" type="float">
      <sql name="price" type="numeric" />
      <bind-xml name="price" node="element" />
    </field>
    <!--  NewProduct has reference to ProductGroup, many products may reference same group  -->
    <field name="group" type="jdo.c972.ProductGroup">
      <sql name="group_id" />
      <bind-xml name="group" node="element" />
    </field>
  </class>
</mapping>

