-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: nullable many-to-one association
PostPosted: Thu Jun 29, 2006 4:46 am 
Beginner
Beginner

Joined: Fri Jun 23, 2006 6:28 am
Posts: 22
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.