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: Jointure HQL
PostPosted: Fri Apr 07, 2006 11:04 am 
Newbie

Joined: Fri Mar 03, 2006 4:25 am
Posts: 3
Bonjour,

Je ne comprends pas pourquoi la jointure suivante :

Code:
select c.CliNom,e.Id,e.EntLibelle,e.EntTelephone,e.EntTaille from Entite e,Client c inner join c.Id as cliId where e.Cli=cliId


me renvoie comme erreur dans mon navigateur :
Quote:
java.lang.NullPointerException
org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:315)
org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3268)
org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3060)
org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2938)
org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:218)
org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158)
org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109)
org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:134)
org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:113)
org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1602)
com.teamlog.intranantes.dao.AccesBase.getListFromQuery(AccesBase.java:262)
com.teamlog.intranantes.metier.RechercheEntitesMetier.getListeEntites(RechercheEntitesMetier.java:187)
com.teamlog.intranantes.presentation.action.RechercheEntitesAction.afficherListeEntites(RechercheEntitesAction.java:50)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
com.teamlog.intranantes.presentation.action.DispatchActionProtected.execute(DispatchActionProtected.java:35)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


Merci de votre aide !


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 12:37 pm 
Regular
Regular

Joined: Sat May 15, 2004 4:27 am
Posts: 79
Essaye juste un :

select c.CliNom,e.Id,e.EntLibelle,e.EntTelephone,e.EntTaille
from Entite As e
join e.client As cliId

// Pas besoin de where. Hibernate le gère trés bien tout seul

ps: si cette réponse est utilie merci d'augmenter mon crédit


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 24, 2006 12:51 pm 
Regular
Regular

Joined: Sat May 15, 2004 4:27 am
Posts: 79
Désolé je me suis trompé. Dans le cas où il y a une relation entre Entite et Client tu
dois faire ça :

SELECT c.CliNom,e.Id,e.EntLibelle,e.EntTelephone,e.EntTaille
FROM Entite As e
join e.client As c

Voilà. Avec les coquilles en moins du premier post


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.