-->
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: Fk qui fait reference à une partie de la PK
PostPosted: Fri Feb 06, 2009 11:02 am 
Beginner
Beginner

Joined: Thu Jun 30, 2005 1:04 pm
Posts: 26
Hibernate version: 3.2.4

Name and version of the database you are using:Oracle 10


J'ai une Foreign key qui est une parti d'une Primary Key :
Ca semble marcher en hbm quand on référence qu'une seule colonne. Mais je n'y arrive pas en JPA

Exemple de ficheir hbm.xml
Mapping documents:
Code:
   <class name="com.test.FooHbm">
      <composite-id name="id" class="com.test.FooId">
         <key-property name="num" type="integer"></key-property>
         <key-property name="code" type="integer"></key-property>
      </composite-id>
      <bag name="bars" inverse="true">
         <key column="NUMFK" property-ref="id.num"></key>
         <one-to-many class="com.test.BarHbm" />
      </bag>

   </class>
   <class name="com.test.BarHbm">
      <id name="id" type="integer" />
      <many-to-one name="foo" column="NUMFK" property-ref="id.num"
         class="com.test.FooHbm">
      </many-to-one>
   </class>


J'ai tenté la même chose en Annotation :
@ManyToOne
@JoinColumn(name = "FOO_NUM", referencedColumnName = "id.num")
Foo foo;
But i have the error message : "A Foreign key refering com.test.Foo from com.test.Bar has the wrong number of column. should be 2"

J'ai même essayé en faisant générer mes fichier annotés à partir des fichier hbm par les tools hibernate, mais ca ne marche pas non plus.

Une idée ?
Merci d'avance


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.