"ORA-00904: invalid identifier" Error when Using Subqueries in JPQL Query (Doc ID 1599956.1)

Last updated on AUGUST 15, 2016

Applies to:

Oracle TopLink - Version 12.1.1.0 to 12.1.1.0 [Release 12c]
Information in this document applies to any platform.

Symptoms

A JPQL query consists of multiple subqueries which refer to same join in parent statement :

The issue is that the second sub-query uses a join from the source query (t2.ID = t4.ID)  that was used in the first sub-query.

As a consequence,  this query fails with the following error :
ORA-00904- Error : java.sql.SQLSyntaxErrorException: ORA-00904: invalid identifier

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms