-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problem with query on one-to-one
PostPosted: Mon Jul 26, 2004 9:05 am 
Newbie

Joined: Thu Jun 10, 2004 5:37 am
Posts: 19
<class name = "MaClasse" ...>
<id>
..
</id>
<one-to-one name="voie" class="HbVoie" cascade="none"/>
...
</class>

"SELECT voie FROM MaClass AS mclass JOIN mclass.voie AS voie"

returns nothing, but in the database there are some data corresponding to this query.

And furthermore, if I do my mapping like this :
<class name = "MaClasse" ...>
<id>
..
</id>
<property name="idVoie" column="ID_VOIE" type="java.lang.Long"/>
...
</class>

idVoie is a foreign key which references the primary of another table mapped by the JAVA class HbVoie.

and then if I do the query like this (the same query but with the new mapping) :

SELECT voie FROM MaClass AS mclass, HbVoie AS voie
WHERE MaClass.idVoie = voie.id

it returns something !! But when you read these two query you can see there are the same !

Why do I have this problem ?

thanks,

Nicolas


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 27, 2004 12:10 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
a one-to-one means sharing the same PK value.
Whet you want is a <ont-to-one foreign-key> or a many to one.

_________________
Emmanuel


Top
 Profile  
 
 Post subject: OK
PostPosted: Mon Aug 09, 2004 12:39 pm 
Newbie

Joined: Thu Jun 10, 2004 5:37 am
Posts: 19
that's the solution,

Thank you


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.