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

Unable to omit optional entity identification variable from arguments to built-in aggregate functions #2192

Closed
ajaypaul-ibm opened this issue Jul 2, 2024 · 2 comments · Fixed by #2254

Comments

@ajaypaul-ibm
Copy link
Contributor

When attempting to invoke aggregate functions in JPQL and supplying an argument that omits the optional entity identification variable, such as,

SELECT MAX(price) FROM Item
SELECT MIN(price) FROM Item
SELECT AVG(price) FROM Item

EclipseLink is rejecting the JPQL claiming there is a syntax error,


Caused by: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: 
Exception Description: Syntax error parsing [SELECT MAX(price) FROM Item]. 
[11, 16] The encapsulated expression is not a valid expression.
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1848)
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1869)
	at io.openliberty.data.internal.persistence.RepositoryImpl.invoke(RepositoryImpl.java:871)
	... 38 more
Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 5.0.0-B02.v202404111748): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Syntax error parsing [SELECT MAX(price) FROM Item]. 
[11, 16] The encapsulated expression is not a valid expression.
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildException(HermesParser.java:169)
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.validate(HermesParser.java:345)
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(HermesParser.java:292)
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildQuery(HermesParser.java:174)
	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)
	... 40 more
@Riva-Tholoor-Philip
Copy link
Contributor

I am looking in to this issue

rfelcman added a commit to rfelcman/eclipselink that referenced this issue Sep 4, 2024
JPQL SELECT not allowing entity attribute without optional entity identification variable eclipse-ee4j#2182 - bug fix (main + tests)
 Unable to omit optional entity identification variable from arguments to built-in aggregate functions eclipse-ee4j#2192 - bug fix (main + tests)

Signed-off-by: Radek Felcman <[email protected]>
joe-chacko pushed a commit to joe-chacko/eclipselink that referenced this issue Sep 5, 2024
JPQL SELECT not allowing entity attribute without optional entity identification variable eclipse-ee4j#2182 - bug fix (main + tests)
 Unable to omit optional entity identification variable from arguments to built-in aggregate functions eclipse-ee4j#2192 - bug fix (main + tests)

Signed-off-by: Radek Felcman <[email protected]>
rfelcman added a commit to rfelcman/eclipselink that referenced this issue Sep 9, 2024
JPQL SELECT not allowing entity attribute without optional entity identification variable eclipse-ee4j#2182 - bug fix (main + tests)
 Unable to omit optional entity identification variable from arguments to built-in aggregate functions eclipse-ee4j#2192 - bug fix (main + tests)

Signed-off-by: Radek Felcman <[email protected]>
rfelcman added a commit to rfelcman/eclipselink that referenced this issue Sep 9, 2024
…ipse-ee4j#2192 issues

JPQL SELECT not allowing entity attribute without optional entity identification variable eclipse-ee4j#2182 - bug fix (main + tests)
NullPointerException when JPQL UPDATE assignment operation omits optional identification variable eclipse-ee4j#2184 - bug fix (main + tests)
Unable to omit optional entity identification variable from arguments to built-in aggregate functions eclipse-ee4j#2192 - bug fix (main + tests)

Signed-off-by: Radek Felcman <[email protected]>
rfelcman added a commit to rfelcman/eclipselink that referenced this issue Sep 10, 2024
…e-ee4j#2192, eclipse-ee4j#2247 issues

JPQL SELECT not allowing entity attribute without optional entity identification variable eclipse-ee4j#2182 - bug fix (main + tests)
NullPointerException when JPQL UPDATE assignment operation omits optional identification variable eclipse-ee4j#2184 - bug fix (main + tests)
Unable to omit optional entity identification variable from arguments to built-in aggregate functions eclipse-ee4j#2192 - bug fix (main + tests)
Arithmetic expressions in SELECT clause broken when entity identifier variable omitted eclipse-ee4j#2247 - bug fix (main + tests)

Signed-off-by: Radek Felcman <[email protected]>
rfelcman added a commit that referenced this issue Sep 11, 2024
JPQL SELECT not allowing entity attribute without optional entity identification variable #2182 - bug fix (main + tests)
NullPointerException when JPQL UPDATE assignment operation omits optional identification variable #2184 - bug fix (main + tests)
Unable to omit optional entity identification variable from arguments to built-in aggregate functions #2192 - bug fix (main + tests)
Arithmetic expressions in SELECT clause broken when entity identifier variable omitted #2247 - bug fix (main + tests)

Signed-off-by: Radek Felcman <[email protected]>
@rfelcman
Copy link
Contributor

Hello, You can verify fixes in the latest snapshots from 5.0.0-20240911.143118-65 or 5.0.0-B03 from the Maven Central.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants