-->
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.  [ 2 posts ] 
Author Message
 Post subject: Probléme de mapping one to many
PostPosted: Wed Apr 19, 2006 7:34 am 
Newbie

Joined: Wed Apr 19, 2006 7:26 am
Posts: 2
Bonjour,

Je débute avec Hibernate est j'ai du mal à comprendre les relations. Dans mon cas concret j'ai 2 entitée(Extraction et Réponse) une extration donne lieu à plusieurs réponses et une réponse appartient à une seule extraction. J'ai donc du coté d'extraction définit un mapping du type "one-to-many":
Code:
<hibernate-mapping>
   <class name="fr.pagesjaunes.ocp.donnees.Extraction" table="extraction">
      <id name="idExtraction" column="idextraction">
         <generator class="increment"/>
      </id>
      <property name="labelExtraction" column="labelextraction" not-null="true" />
      <property name="dateCreationExtraction" column="datecreationextraction" not-null="true" />
      <set name="reponses" cascade="all" lazy="true" table="extraction">
         <key column="idextraction"/>
         <one-to-many class="fr.pagesjaunes.ocp.donnees.Reponse"/>
       </set>
   </class>
</hibernate-mapping>

Et du coté de la reponse comme cela:
Code:
<hibernate-mapping>
   
   <class name="fr.pagesjaunes.ocp.donnees.Reponse" table="reponse">
      <id name="idReponse" column="idreponse">
         <generator class="increment"/>
      </id>
      <property name="nbParutions" column="nbparutions" not-null="true" />
      <property name="activites" column="activites" not-null="true" />
      
      </class>
   
</hibernate-mapping>

Probléme, quand je souhaite récupéré la liste des réponses pour une extraction voici la réponse:
Quote:
could not resolve property: idextraction of: fr.pagesjaunes.ocp.donnees.Reponse [from fr.pagesjaunes.ocp.donnees.Reponse rep where rep.idextraction =7]
at org.hibernate.persister.entity.AbstractPropertyMapping.throwPropertyException(AbstractPropertyMapping.java:43)
at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:37)
at org.hibernate.persister.entity.AbstractEntityPersist.............

Merci de votre aide et bonne journée


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 6:07 pm 
Newbie

Joined: Wed Apr 19, 2006 2:51 pm
Posts: 16
<set name="reponses" cascade="all" lazy="true" table="extraction">
<key column="idextraction"/>
<one-to-many class="fr.pagesjaunes.ocp.donnees.Reponse"/>
</set>


le mapping ici doit pointer sur la table des réponses pas des extractions !

_________________
Cheers,
Laurent

Thanks for rating in case it helped !


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

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.