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) not accepted in SELECT, WHERE, and ORDER BY clauses #28925

Open
njr-11 opened this issue Jun 27, 2024 · 1 comment
Open

id(this) not accepted in SELECT, WHERE, and ORDER BY clauses #28925

njr-11 opened this issue Jun 27, 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 Jun 27, 2024

EclipseLink is not accepting the id(this) operation, which is new in Jakarta Persistence 3.2, when it is placed within a JPQL SELECT or WHERE clause. (It's possible other clauses might not work either -- this query only tried SELECT and WHERE),

SELECT ID(THIS) FROM Prime o WHERE (o.name = :numberName OR :numeral=o.romanNumeral OR o.hex =:hex OR ID(THIS)=:num) ORDER BY o.numberId

Here is the error:

[6/27/24, 10:55:23:528 CDT] 00000056 id=32ba8eee io.openliberty.data.internal.persistence.RepositoryImpl      > invoke Primes.matchAny Entry  
                                                                                                               19
                                                                                                               XLVII
                                                                                                               2B
                                                                                                               twenty-nine
[6/27/24, 10:55:23:528 CDT] 00000056 id=32ba8eee io.openliberty.data.internal.persistence.RepositoryImpl      3 QueryInfo@1bd26868 long[] matchAny(long, String, String, String) SELECT ID(THIS) FROM Prime o WHERE (o.name = :numberName OR :numeral=o.romanNumeral OR o.hex =:hex OR ID(THIS)=:num) ORDER BY o.numberId [4 named params]
[6/27/24, 10:55:23:528 CDT] 00000056 id=1bd26868 io.openliberty.data.internal.persistence.QueryInfo           3 hasDynamicSortCriteria? false
[6/27/24, 10:55:23:528 CDT] 00000056 id=694e0a82 enliberty.data.internal.persistence.service.DBStoreEMBuilder > createEntityManager Entry 
[6/27/24, 10:55:23:528 CDT] 00000056 id=3b540f18 om.ibm.wsspi.persistence.internal.PersistenceServiceUnitImpl > createEntityManager Entry 
[6/27/24, 10:55:23:528 CDT] 00000056 id=3b540f18 om.ibm.wsspi.persistence.internal.PersistenceServiceUnitImpl < createEntityManager Exit  
                                                                                                               org.eclipse.persistence.internal.jpa.EntityManagerImpl@424342bb
[6/27/24, 10:55:23:528 CDT] 00000056 id=694e0a82 enliberty.data.internal.persistence.service.DBStoreEMBuilder < createEntityManager Exit  
                                                                                                               org.eclipse.persistence.internal.jpa.EntityManagerImpl@424342bb
[6/27/24, 10:55:23:528 CDT] 00000056 id=32ba8eee io.openliberty.data.internal.persistence.RepositoryImpl      3 createQuery 
                                                                                                               SELECT ID(THIS) FROM Prime o WHERE (o.name = :numberName OR :numeral=o.romanNumeral OR o.hex =:hex OR ID(THIS)=:num) ORDER BY o.numberId
                                                                                                               test.jakarta.data.web.Prime
[6/27/24, 10:55:23:532 CDT] 00000056 id=00000000 io.openliberty.data.internal.persistence.RepositoryImpl      3 java.lang.IllegalArgumentException replaced with jakarta.data.exceptions.MappingException
[6/27/24, 10:55:23:532 CDT] 00000056 id=32ba8eee io.openliberty.data.internal.persistence.RepositoryImpl      < invoke Primes.matchAny Exit  
                                                                                                               jakarta.data.exceptions.MappingException: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: 
Exception Description: Problem compiling [SELECT ID(THIS) FROM Prime o WHERE (o.name = :numberName OR :numeral=o.romanNumeral OR o.hex =:hex OR ID(THIS)=:num) ORDER BY o.numberId]. 
[10, 14] The identification variable 'THIS' is not defined in the FROM clause.
[108, 112] The identification variable 'THIS' is not defined in the FROM clause.
	at io.openliberty.data.internal.persistence.RepositoryImpl.failure(RepositoryImpl.java:302)
	at io.openliberty.data.internal.persistence.RepositoryImpl.invoke(RepositoryImpl.java:1256)
	at jdk.proxy14/jdk.proxy14.$Proxy54.matchAny(Unknown Source)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.jboss.weld.bean.proxy.InterceptedProxyMethodHandler.invoke(InterceptedProxyMethodHandler.java:52)
	at test.jakarta.data.web.Primes$Proxy$_$$_WeldInterceptedProxy1.matchAny(Unknown Source)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:38)
	at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:109)
	at test.jakarta.data.web.Primes$1501238887$Proxy$_$$_WeldClientProxy.matchAny(Unknown Source)
	at test.jakarta.data.web.DataTestServlet.testNamedParametersFromMethodParameterNames(DataTestServlet.java:3154)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at componenttest.app.FATServlet.doGet(FATServlet.java:74)
	at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:633)
	at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:723)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1266)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:754)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:451)
	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1362)
	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1078)
	at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:77)
	at com.ibm.ws.webcontainer40.servlet.CacheServletWrapper40.handleRequest(CacheServletWrapper40.java:87)
	at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:978)
	at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:293)
	at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:1260)
	at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.wrapHandlerAndExecute(HttpDispatcherLink.java:476)
	at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:435)
	at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:569)
	at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:503)
	at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:363)
	at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:330)
	at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:169)
	at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:77)
	at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:516)
	at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:586)
	at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:970)
	at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1059)
	at com.ibm.ws.threading.internal.ExecutorServiceImpl$RunnableWrapper.run(ExecutorServiceImpl.java:280)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: 
Exception Description: Problem compiling [SELECT ID(THIS) FROM Prime o WHERE (o.name = :numberName OR :numeral=o.romanNumeral OR o.hex =:hex OR ID(THIS)=:num) ORDER BY o.numberId]. 
[10, 14] The identification variable 'THIS' is not defined in the FROM clause.
[108, 112] The identification variable 'THIS' is not defined in the FROM clause.
	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)
	... 42 more
Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 5.0.0-B02.v202404111748): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Problem compiling [SELECT ID(THIS) FROM Prime o WHERE (o.name = :numberName OR :numeral=o.romanNumeral OR o.hex =:hex OR ID(THIS)=:num) ORDER BY o.numberId]. 
[10, 14] The identification variable 'THIS' is not defined in the FROM clause.
[108, 112] The identification variable 'THIS' is not defined in the FROM clause.
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildException(HermesParser.java:169)
	at org.eclipse.persistence.internal.jpa.jpql.HermesParser.validate(HermesParser.java:358)
	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)
	... 44 more

Similarly, id(this) is also not working in the ORDER BY clause.

@njr-11 njr-11 added bug This bug is not present in a released version of Open Liberty in:JPA team:Blizzard labels Jun 27, 2024
@Riva-Tholoor-Philip
Copy link
Contributor

See EclipseLink Issue : 2189

@njr-11 njr-11 changed the title id(this) not accepted in SELECT and WHERE clauses id(this) not accepted in SELECT, WHERE, and ORDER BY clauses Jul 16, 2024
KyleAure added a commit to KyleAure/open-liberty that referenced this issue Jul 23, 2024
KyleAure added a commit to KyleAure/open-liberty that referenced this issue Jul 23, 2024
KyleAure added a commit to KyleAure/open-liberty that referenced this issue Jul 24, 2024
njr-11 added a commit to njr-11/open-liberty that referenced this issue Oct 11, 2024
njr-11 added a commit to njr-11/open-liberty that referenced this issue Oct 11, 2024
njr-11 added a commit to njr-11/open-liberty that referenced this issue Oct 11, 2024
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