-->
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: Subselect dans la projection?
PostPosted: Mon Oct 17, 2005 6:41 am 
Newbie

Joined: Wed Oct 12, 2005 10:50 am
Posts: 4
Bonjour à tous!

Je suis relativement nouveau dans le monde du HQL. J'ai toujours été un grand fan de Oracle. Je participe présentement à un projet où de dois faire des requête plutôt complexe.

J'essais de faire un HQL d'un subselect qui est dans la projection... J'ai essayé plusieurs manière, sans succès. La documentation sur les subselects est très limité...

Voici le HQL que j'essais d'exécuter:

SELECT new Map((SELECT AD.RUE FROM ADRESSE AD WHERE AD.PERSONNE = PE AND AD.CODE > 12) AS RUE, PE.NOM AS NOM)
FROM PERSONNE PE

L'erreur géré:
15:00:37,639 INFO [STDOUT] Caused by: java.lang.NullPointerException
15:00:37,639 INFO [STDOUT] at org.hibernate.hql.antlr.HqlSqlBaseWalker.aliasedSelectExpr(HqlSqlBaseWalker.java:1703)
15:00:37,639 INFO [STDOUT] at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:1474)
15:00:37,639 INFO [STDOUT] at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1041)
15:00:37,639 INFO [STDOUT] at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:380)
15:00:37,639 INFO [STDOUT] at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:201)
15:00:37,639 INFO [STDOUT] at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:151)
15:00:37,639 INFO [STDOUT] at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
15:00:37,686 INFO [STDOUT] at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
15:00:37,686 INFO [STDOUT] at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
15:00:37,686 INFO [STDOUT] at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
15:00:37,686 INFO [STDOUT] at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
15:00:37,686 INFO [STDOUT] at org.hibernate.impl.SessionImpl.list(SessionImpl.java:834)
15:00:37,686 INFO [STDOUT] at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)

Je sais que se ne son pas toutes les bases de données qui supporte le subselect comme projection mais j'ai crue comprendre que le HQL se transforme naturellement en SQL et que si la base de donnée le supporte, HQL devrait géré un SQL valide. Quelqu'un sait si c'est possible?

Merci!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 12:20 am 
Newbie

Joined: Wed Oct 12, 2005 9:20 pm
Posts: 16
Location: Sydney
Bonjour,

Avez-vous teste le sub-select seul avant de l'integre dans une requette plus importante ?

Quel est le resultat ?

Car l'erreur semble indique que le sous-resultat est null ou qu'un des attributs est null.

J'espere que ca peut aider.

Ben


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.