Hibernate version:
2.1
Mapping documents:
Code:
<class name="org.blah.ServiceLineItem"
table="service_order_detail"
dynamic-update="false"
dynamic-insert="false">
<composite-id>
<key-property name="webOrderId" column="serviceorderid"/>
<key-property name="serviceCode" column="servicecode"/>
</composite-id>
<timestamp name="lastUpdated" column="lastmodifieddate"/>
<property name="quantity" column="quantity"/>
<property name="deleted" column="deletestatus" type="yes_no"/>
<property name="shipmentStatus" column="shippedstatus"/>
<property name="shipmentMethod" column="shippingmethodcode"/>
<property name="shipmentDate" column="shippingdate"/>
<many-to-one name="product" column="servicecode" cascade="none" insert="false" update="false" class="org.blah.Service"/>
</class>
Code between sessionFactory.openSession() and session.close():Code:
Order o = (Order) it.next();
if(o.getWebOrderId() == -1)
session.save(o);
session.flush();
Hi,
I have a simple order model with order, detail, and product objects. There is a one-to-many relationship between the order and details and there is a many-to-one relationship between details and a product.
I'd like to cascade insert the order and details, but stop short of modifying the product object. I tried to accomplish this by setting the cascade, insert, and update atttributes, but is still trying to update my Service object. The only thing unusual about the detail mapping is that it shares a column with a composite-id (legacy database).
I feel that I must be missing something very simple. Would someone please give me a hint?
thanks,
laphroaig