-->
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: one-to-one & mandatory fields
PostPosted: Fri Jun 09, 2006 8:26 am 
Newbie

Joined: Fri Jun 09, 2006 8:07 am
Posts: 1
Hi,

I'm getting a org.hibernate.PropertyNotFoundException: field not found: numero with this mapping.

The problem is because I don't have the filed numero in IPT class. Is it mandatory? or is there a way to create this relation without put numero field in IPT class? It's a simple aggregation and I think that doesn't make sense to create an "auxiliar" field...

Thanks,

André


Femea.java
Code:
public class Femea {
   private Integer numero;
   private IPT ipt;
}



IPT.java
Code:
public class IPT {
   private Femea femea;
}


Femea.hbm.xml
Code:
<class name="Femea" table="ANIMAL" catalog="REBANHO">
    <id name="numero" type="int">
       <column name="NR_ANIMAL" />
       <generator   
           class="AnimalIdentifierGenerator" />
    </id>
    <one-to-one name="ipt" class="IPT" />
</class>


IPT.hbm.xml
Code:
<class name="IPT" table="IPT" catalog="REBANHO"> 
   <id name="numero" column="NR_FEMEA">
      <generator class="foreign">
         <param name="property">femea</param>
      </generator>           
   </id>               
   <one-to-one name="femea" class="Femea" constrained="true" />
</class>


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.