HQL: Combining a CROSS JOIN with a LEFT JOIN which requires a WITH clause triggers an
exception.
-------------------------------------------------------------------------------------------------
Key: HHH-7321
URL:
https://hibernate.onjira.com/browse/HHH-7321
Project: Hibernate ORM
Issue Type: Bug
Components: query-hql
Affects Versions: 4.1.3, 4.1.0
Environment: JDK 7.0 Update 4
JBoss AS 7.0.1 Final
Reporter: negora
I'm trying to combine a CROSS JOIN with a LEFT JOIN. The last one requires a WITH
clause that references one of tables used in the CROSS JOIN. For example, I want to list
students, questions of an exam, and their answers to them. Some answers may not exist,
thus I'm using a LEFT JOIN:
SELECT s.studentId, q.questionId, sa.answer
FROM Student s, Question q
LEFT JOIN s.studentAnswerList AS sa WITH sa.question.questionId = q.questionId
This causes an exception: javax.ejb.EJBException: java.lang.IllegalArgumentException:
org.hibernate.hql.internal.ast.QuerySyntaxException: with-clause referenced two different
from-clause elements .
The entities are really simple. These are their attributes:
- Student.studentId
- Question.questionId
- StudentAsnwer.studentAnswerId
- StudentAsnwer.studentId
- StudentAsnwer.questionId
- StudentAsnwer.answer
I've been suffering from the same problem in both 3.x and 4.x versions of Hibernate.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira