-->
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.  [ 4 posts ] 
Author Message
 Post subject: left outer join problem
PostPosted: Fri Apr 23, 2004 7:10 pm 
Newbie

Joined: Fri Apr 23, 2004 7:00 pm
Posts: 2
Location: San Francisco
I am using hibernate-2.1 with Oracle 9i database. I'm trying to run the following query:

"select quest, count(answerResp) " +
"from Survey survey, " +
"User user, " +
"SurveyParticipant participant, " +
"SurveyResponse surveyResp, " +
"Question quest, " +
"QuestionResponse questResp " +
"AnswerResponse answerResp " +
"where survey.primaryKey = ? " +
"and user.primaryKey = ? " +
"and participant.user = user " +
"and participant.survey = survey " +
"and surveyResp.survey = survey " +
"and surveyResp.respondent = participant " +
"and quest.survey = survey " +
"and quest.required = 'T' " +
"and quest.questionType != " + QuestionType.DATA_TABLE.toInt() + " " +
"and questResp.question = quest " +
"and questResp.response = surveyResp " +
"left outer join answerResp.questionResponse as questResp " +
"group by quest " +
"having count(answerResp) = 0 " ;

i think the left outer join it causing the problem but i don't know how to reslove it, or what the problem is exactly.

I'm getting this error when parsing the query:


DEBUG QueryTranslator:147 - compiling query
DEBUG QueryTranslator:165 - unexpected query compilation problem
java.util.NoSuchElementException
at java.util.LinkedList.getLast(LinkedList.java:114)
at net.sf.hibernate.hql.WhereParser.closeExpression(WhereParser.java:293)
at net.sf.hibernate.hql.WhereParser.token(WhereParser.java:233)
at net.sf.hibernate.hql.WhereParser.end(WhereParser.java:275)
at net.sf.hibernate.hql.ClauseParser.endChild(ClauseParser.java:100)
at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:64)
at net.sf.hibernate.hql.PreprocessingParser.token(PreprocessingParser.java:123)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29)


please help...


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 24, 2004 9:59 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
As a first start, dont use string concatenation to set your parameters, but setParameter() instead.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 24, 2004 1:34 pm 
Newbie

Joined: Fri Apr 23, 2004 7:00 pm
Posts: 2
Location: San Francisco
in posting # 929934 you say "arbitary outer joins in HQL are not possible yet. You can use createSqlQuery to workaround probably."

please define "arbitrary", i'm not sure what you mean.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 24, 2004 2:13 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
joins with an explicit "on" condition.


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