Folks,
I tried to insert a new record (with two many-to-one associations, first one is a pure simple many-to-one association, second one is within a component). However, it looks like the setting cascade="none" has no effect on the second many-to-one association (i.e. one within the component) and Hibernate generates the TransientObjectException, any ideas?
P.S.
The first many-to-one association works fine (with cascade="none" too) which Hibernate would ignore it during the insert.
Thanks in advance!
Martin
Hibernate version:
2.1.6
Mapping documents:
Code:
<many-to-one name="commodity" column="COMMODITYOBJID" class="global.vo.CommodityVO"
cascade="none"/>
<component name="cmv" class="global.jb.Cost">
<many-to-one name="currency" column="CMVCURRENCY_GNLUOBJID" class="global.vo.CurrencyVO"
cascade="none"
outer-join="false"
/>
<property name="amount" column="CMVAMOUNT" type="double"/>
</component>
Code between sessionFactory.openSession() and session.close():Code:
addedObject = session.saveOrUpdateCopy(vo);
session.flush();
Full stack trace of any exception that occurs:Code:
net.sf.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: global.vo.CurrencyVO
Name and version of the database you are using:
Oracle 8.1.7
Debug level Hibernate log excerpt: