Hi !

I'm having some difficulties to implement the following mapping:

  <class name="SalesOrder" identity="id" key-generator="IDENTITY">
    <description>SalesOrder</description>  
    
    <cache-type type="none"/>
    
    <map-to table="sales_order"/>
        
    <field name="id" type="integer">
      <sql name="id" type="integer"/>
    </field>            
    
    <field name="orderItens" type="OrderItem" collection="collection" lazy="true">
      <sql many-key="id_order" many-table="order_item" name="id"/>
    </field>

  </class>

  <class name="OrderItem" identity="id" key-generator="IDENTITY">
    <description>OrderItem</description>  
    
    <cache-type type="none"/>
    
    <map-to table="order_item"/>
        
    <field name="id" type="integer">
      <sql name="id" type="integer"/>
    </field>
    
    <field name="order" type="SalesOrder">
      <sql name="id_order"/>
    </field> 
    
  </class>

  <class name="PhotoOrder" extends="OrderItem" identity="id" key-generator="IDENTITY">
    <description>PhotoOrder</description>  
    
    <cache-type type="none"/>
    
    <map-to table="photo_order"/>

    .....

  </class>

When I perform a "database.create(salesOrder)", Castor add rows only in the
sales_order table and it doesn't consider the relation among the objects. 

I supposed that Castor should add rows to sales_order and then add rows
in order_item and so insert rows in photo_order when the item on operation
is of this type. Am I wrong ? All tables have their "id" field and this is true for the
table "photo_order" due to inheritance.

Thanks in advance !
Michel.

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to