-->
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 Not All Parameters were set
PostPosted: Fri Apr 04, 2008 4:26 am 
Newbie

Joined: Fri Apr 04, 2008 4:09 am
Posts: 2
J'ai un mapping du style

Code:
<hibernate-mapping>
  <class name="Salarie" table="SALARIE" lazy="true">
    <id name="id" column="SALARIE_" type="integer">
      <generator class="foreign">
        <param name="property">personne</param>
      </generator>
    </id>
...
<one-to-one name="personne" class="Personne" constrained="true"/>
</hibernate-mapping>


J'ai une requête HQL :

Code:
Query query = aSession.createQuery("from Salarie s where s.personne=:param");
query.setParameter("param", unePersonne);
query.uniqueResult();


Et là j'obtiens une erreur SQL car le paramètre de cette requête n'est pas valué par Hibernate.

Par contre si je fais :
Code:
Query query = aSession.createQuery("from Salarie s where s.personne.id=:param");
query.setParameter("param", unePersonne.getId());
query.uniqueResult();


Ca fonctionne.

Avec des relations mappés en many-to-one, ça marche.

Cela ressemble donc à un bug Hibernate.[/b]


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.