Hi !
I'm having a java.lang.StackOverflowError trying to persist
one of my objects in the database. I have an ecommerce app and
I map the following to process my orders:
<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-table="order_item" many-key="id_order"/>
</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="ProductOrder" extends="OrderItem" identity="id"
key-generator="IDENTITY">
<description>ProductOrder</description>
<cache-type type="unlimited"/>
<field name="id" type="integer">
<sql name="id" type="integer"/>
</field>
...
</class>
When I try to do :
try {
controller.getDatabase().begin();
controller.getDatabase().create(salesOrder);
controller.getDatabase().commit();
} catch (PersistenceException e) {
e.printStackTrace();
}
I have the StackOverflowError. The strange is that
the "create" inserts about 200 lines in the table
"sales_order" where it should insert exactly one
( the first row present in the table after executing
the operation ).
Could anybody help me ? Did I map it in a bad way ?
Thanks in advance !
Michel.
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev