This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 293775 - A JOIN FETCH alias causes 'MismatchedTokenException'
Summary: A JOIN FETCH alias causes 'MismatchedTokenException'
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: James Sutherland CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-30 08:00 EDT by Dan Siviter CLA
Modified: 2022-06-09 10:06 EDT (History)
2 users (show)

See Also:


Attachments
Bug stacktrace (2.62 KB, text/plain)
2009-10-30 08:01 EDT, Dan Siviter CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Siviter CLA 2009-10-30 08:00:12 EDT
User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
Build Identifier: 2.0.0.v20091026-r5655

When utilising a named query that contains one or more JOIN FETCHs it throws a MismatchedTokenException saying the aliases are incorrect syntax. An example of that is:

SELECT js FROM JobScenario js JOIN FETCH js.scenarioDefinition sd ORDER BY js.scenario

It will fail citing the 'sd' alias is invalid syntax regardless of if you utilise the 'sd' or not in a subsiquent JOIN FETCH, where clause, etc.

Reproducible: Always

Steps to Reproduce:
1. Attempt any query with a JOIN FETCH alias (sorry I can't submit the code)
Comment 1 Dan Siviter CLA 2009-10-30 08:01:56 EDT
Created attachment 150914 [details]
Bug stacktrace
Comment 2 Gordon Yorke CLA 2009-10-30 09:03:21 EDT
This is functionality we would like to support in the future and is supported using the new Criteria API from JPA 2.0.

However the JPA specification currently disallows this functionality within the JPQL statement.

You would have to change your query to 

SELECT js FROM JobScenario js JOIN FETCH js.scenarioDefinition join js.scenarioDefinition AS sd ORDER BY
js.scenario
Comment 3 James Sutherland CLA 2012-02-06 14:48:47 EST
Fixed in Hermes
Comment 4 James Sutherland CLA 2012-04-11 10:48:07 EDT
Fixed in 2.4
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:06:14 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink