This one time, at band camp, Michel Bertrand said:

MB>I'm having a java.lang.StackOverflowError trying to persist
MB>one of my objects in the database. I have an ecommerce app and
MB>I map the following to process my orders:
MB>
MB>  <class name="SalesOrder" identity="id" key-generator="IDENTITY">
MB>    <description>SalesOrder</description>  
MB>    
MB>    <cache-type type="none"/>
MB>    
MB>    <map-to table="sales_order"/>
MB>     
MB>    <field name="id" type="integer">
MB>      <sql name="id" type="integer"/>
MB>    </field>         
MB>
MB>    
MB>    <field name="orderItens" type="OrderItem" collection="collection" lazy="true">
MB>      <sql many-table="order_item" many-key="id_order"/>
MB>    </field>   
MB>
MB>    ...
MB>     
MB>  </class>   
MB>
MB>  <class name="OrderItem" identity="id" key-generator="IDENTITY">
MB>    <description>OrderItem</description>  
MB>    
MB>    <cache-type type="none"/>
MB>    
MB>    <map-to table="order_item"/>
MB>     
MB>    <field name="id" type="integer">
MB>      <sql name="id" type="integer"/>
MB>    </field>
MB>    
MB>    <field name="order" type="SalesOrder">
MB>      <sql name="id_order"/>
MB>    </field> 
MB>    
MB>  </class>   
MB>
MB>  <class name="ProductOrder" extends="OrderItem" identity="id" 
key-generator="IDENTITY">
MB>    <description>ProductOrder</description>
MB>    
MB>    <cache-type type="unlimited"/>
MB>    
MB>    <field name="id" type="integer">
MB>      <sql name="id" type="integer"/>
MB>    </field>
MB>    
MB>    ...
MB>    
MB>  </class>
MB>
MB>
MB>When I try to do :
MB>
MB>try {
MB>     controller.getDatabase().begin();
MB>     controller.getDatabase().create(salesOrder);
MB>     controller.getDatabase().commit();                      
MB>} catch (PersistenceException e) {
MB>     e.printStackTrace();
MB>}
MB>
MB>I have the StackOverflowError. The strange is that
MB>the "create" inserts about 200 lines in the table
MB>"sales_order" where it should insert exactly one
MB>( the first row present in the table after executing
MB>the operation ).
MB>
MB>Could anybody help me ? Did I map it in a bad way ?

Michel,

Please post the full stack trace of the exception. 

Bruce
-- 
perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

The Castor Project 
http://www.castor.org/

Apache Geronimo 
http://incubator.apache.org/projects/geronimo.html

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

Reply via email to