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.