Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

id(this) still not accepted in ORDER BY clause #30093

Open
njr-11 opened this issue Nov 6, 2024 · 1 comment
Open

id(this) still not accepted in ORDER BY clause #30093

njr-11 opened this issue Nov 6, 2024 · 1 comment
Labels
bug This bug is not present in a released version of Open Liberty in:JPA team:Blizzard

Comments

@njr-11
Copy link
Contributor

njr-11 commented Nov 6, 2024

EclipseLink is not accepting the id(this) operation, which is new in Jakarta Persistence 3.2, when it is placed within a JPQL ORDER BY clause.

SELECT ID(THIS) FROM Prime WHERE ID(THIS) < ?1 ORDER BY ID(THIS) DESC

Here is the error:

Exception [EclipseLink-0] (Eclipse Persistence Services - 5.0.0-B03.v202409121024-4a7149f0cd04d7466837d70f68abb743c88acb83): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Syntax error parsing [SELECT ID(THIS) FROM Prime WHERE ID(THIS) < ?1 ORDER BY ID(THIS) DESC]. 
[56, 64] The order by item is not a valid expression. (SELECT ID(THIS) FROM Prime WHERE ID(THIS) < ?1 ORDER BY  [ ID(THIS) ] ...
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildException(HermesParser.java:175)
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.validate(HermesParser.java:351)
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(HermesParser.java:298)
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildQuery(HermesParser.java:180)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:144)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:120)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:107)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:91)
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1846)
	... 44 more

You can reproduce this by uncommenting the following Jakarta Data test:
test.jakarta.data.web.DataTestServlet.testOrderByIdFunction()

Based on that, you should be able to create a reproducible that only uses JPA.

@anija-anil
Copy link
Contributor

EclipseLink issue : 2297

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This bug is not present in a released version of Open Liberty in:JPA team:Blizzard
Projects
None yet
Development

No branches or pull requests

2 participants