hi guys,
i have a problem with persisting this object:
Hibernate version: 3.2.5
Mapping documents:
<class name="model.order.domain.Order" table="orders">
<id name="id" column="id" >
<generator class="sequence">
<param name="sequence">order_id_seq</param>
</generator>
</id>
<property name="invoiceNumber" column="invoice_number"/>
<component name="grandTotal" class="model.money.domain.Money">
<property name="amount" column="grand_total"/>
<many-to-one name="currency" column="currency_id" formula="currency_id" class="model.money.domain.Currency" cascade="all" />
</component>
<component name="priceTotal" class="model.money.domain.Money">
<property name="amount" column="price_total"/>
<many-to-one name="currency" column="currency_id" formula="currency_id" class="model.money.domain.Currency" cascade="all" />
</component>
<component name="discountTotal" class="model.money.domain.Money">
<property name="amount" column="discount_total"/>
<many-to-one name="currency" column="currency_id" formula="currency_id" class="model.money.domain.Currency" cascade="all" />
</component>
<component name="feeTotal" class="model.money.domain.Money">
<property name="amount" column="fee_total"/>
<many-to-one name="currency" column="currency_id" formula="currency_id" class="model.money.domain.Currency" cascade="all" />
</component>
</class>
So i map (grand_total,currency_id) and (price_total,currency_id) and (discount_total,currency_id) and (fee_total,currency_id) in 4 different Money objects but using the same column currency_id.
While loading of these objects works very well, i have a problem with the persist part; the currency_id column is not included in the generated sql for the insert of the order and i don't understand why because i put cascade="all" for every object.
why doesn't persist also the currency_id column ?
thanks,
viorel
|