Hi
I have another question:
How can I implement an optional many-to-one relationship?
I have made it like this:
Code:
<class name="Fund" table="FONDS" dynamic-update="true" dynamic-insert="true">
<id name="id" type="long" column="ID">
<generator class="assigned"/>
</id>
<many-to-one name="exchangeCode" column="VALOREN_NR" class="ExchangeCode" />
<property name="fondsPreis" column="FONDS_PRICE"/>
<property name="isinNr" column="ISIN_NR"/>
</class>
<class name="ExchangeCode" table="EXCHANGECODE" dynamic-update="true" dynamic-insert="true">
<id name="fundId" column="FONDID" >
<generator class="assigned"/>
</id>
<property name="exchangeCode" column="EXCHANGECODE"/>
</class>
But it throws an Exception:
Code:
net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: 1255410, of class ...
It is because there is now ExchangeCode for the Fund.
I have read some post in the forum, in which they havent found a solution for this problem -->
http://opensource.atlassian.com/projects/hibernate/browse/HHH-86.
Is there no hack to ignore fields which are null?
Hibernate version: 2.1
greets