-->
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: many-to-one join but NOT WITH all columns, please!
PostPosted: Mon Oct 02, 2006 7:58 am 
Newbie

Joined: Mon Sep 18, 2006 6:28 am
Posts: 5
Hibernate version: 3.0.5

Having two tables:

TBFRUITS
________
ID_FRUIT
ID_COLOR


TBTRANSLATECOLORS
_________________
ID_COLOR
ID_LANGUAGE


I'm desesperatelly trying to make a left outer join with only a primary key on the left joined table, but hibernate obligates me to put all primery keys on the hbm


tbfruits.hbm.xml
<many-to-one name="tbtranslatecolors" class="com.mymodel.dto.Tbtranslatecolors" fetch="select">
<column name="ID_COLOR" length="7" />
<column name="ID_LANGUAGE" length="3" />
</many-to-one>


the following HQL:


FROM
com.mymodel.dto.Tbfruits AS tf
left join fetch tf.tbtranslatecolors AS tc


produces a left join for both primary keys on the left joined tbtranslate colors but I only ONE COLUMN so trying to left join ON ID_COLOR


FROM
com.mymodel.dto.Tbfruits AS tf
left join fetch tf.tbtranslatecolors AS tc
on tf.idcolor = tc.idcolor


but this produces a


org.hibernate.hql.ast.QuerySyntaxException: unexpected token: on near line 4, column 1


So how can I obligate HQL to produce a left join only on id_color ?

TIA


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.