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.  [ 2 posts ] 
Author Message
 Post subject: left join sur deux objets qui n'ont pas de relation
PostPosted: Thu Apr 06, 2006 4:50 am 
Newbie

Joined: Thu Apr 06, 2006 4:02 am
Posts: 3
Hibernate version:
Hibernate 3.05

Full stack trace of any exception that occurs:

Name and version of the database you are using:
Oracle 9i

Bonjour,

Je voudrais faire une jointure sur 2 objets qui n'ont pas de lien technique en Java et dans la table mais qui ont un lien metier.

Voici ma requete HQL:

Code:
"select  count(*)  from SightAccount as account left join Client as cl on account.coccRadi = cl.code where account.coccPcen in ( 1103, 1112, 5293 )  and cl.type in ( 5, 10, 11 ) "


Voici le l'exception que j'obtient:

Code:
org.hibernate.hql.ast.QuerySyntaxError: unexpected token: on near line 1, column 163 [select  count(*)  from mypackage.SightAccount as account left join Client as cl on account.coccRadi = cl.code where account.coccPcen in ( 1103, 1112, 5293 )  and cl.type in ( 5, 10, 11 ) ]


En regardant dans la doc j'ai pas trouvé la manière d'ecrire une requete avec left join, donc j'ai fait comme en SQL. Comment faire autrement?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 07, 2006 8:15 am 
Expert
Expert

Joined: Thu Sep 04, 2003 8:23 am
Posts: 368
tu peux essayer
Code:
select  count(*)  from SightAccount as account, Client as cl where account.coccRadi = cl.code and account.coccPcen in ( 1103, 1112, 5293 )  and cl.type in ( 5, 10, 11 )

_________________
Seb
(Please don't forget to give credits if you found this answer useful :)


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