-->
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: Mon Apr 07, 2008 3:18 am 
Newbie

Joined: Fri Apr 04, 2008 4:09 am
Posts: 2
Here is my mapping :

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>


I make an Hql query :

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


When I try to execute this query, I have an error because Hibernate does not assign my parameter "param".

If I modify my query like this :
Code:
Query query = aSession.createQuery("from Salarie s where s.personne.id=:param");
query.setParameter("param", unePersonne.getId());
query.uniqueResult();


It works.

And now, if I modify my mapping, I change the one-to-one relation in a many-to-one relation, it works.


It seems like an Hibernate bug.


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.