Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-dev] t0 not in FROM clause in generated SQL for JUnitJPQLExamplesTestSuite's testExistsExpression

Hi,

Another issue I found while running the JPA test set on Symfoware:

The test simply does a WHERE EXISTS with a subquery. The expected result
should be the same as the following query:

SELECT DISTINCT emp.id FROM Employee emp WHERE EXISTS ( SELECT
managedEmp.id FROM Employee managedEmp WHERE managedEmp = emp.manager)

However, the generated SQL statement (see below), has "t0.EMP_ID" in the
select list of the subquery, while t0 is not in its FROM clause.

SELECT t0.EMP_ID FROM CMP3_EMPLOYEE t0, CMP3_SALARY t1 WHERE (EXISTS
(SELECT t0.EMP_ID FROM CMP3_SALARY t5, CMP3_EMPLOYEE t4, CMP3_SALARY t3,
CMP3_EMPLOYEE t2 WHERE (((t2.EMP_ID = t4.EMP_ID) AND (t1.EMP_ID =
t0.EMP_ID)) AND (((t2.EMP_ID = t0.MANAGER_EMP_ID) AND (t3.EMP_ID =
t2.EMP_ID)) AND (t5.EMP_ID = t4.EMP_ID))))  AND (t1.EMP_ID = t0.EMP_ID))

Is this intended?

This query fails on Symfoware because of that reason.
Maybe other databases are more forgiving?

Thanks,
Dies



Back to the top