You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JPQL queries with embeddable (or relation) attributes that omit the optional entity identification variable (for consistency with JDQL) get IndexOutOfBoundsException on EclipseLink.
Example query:
FROM Business WHERE location.address.city=?1 ORDER BY name
Here is the exception stack with IndexOutOfBoundsException:
[6/27/24, 13:26:52:316 CDT] 00000051 id=079f44f4 io.openliberty.data.internal.persistence.QueryInfo < withJPQL Exit
QueryInfo@2b93bafe Page locatedIn(String, PageRequest, Order) FROM Business WHERE location.address.city=?1 ORDER BY name [1 positional params]
[6/27/24, 13:26:52:338 CDT] 00000051 id=00000000 io.openliberty.data.internal.persistence.PageImpl > <init> Entry
QueryInfo@2b93bafe Page locatedIn(String, PageRequest, Order) FROM Business WHERE location.address.city=?1 ORDER BY name [1 positional params]
PageRequest{page=1, size=6, mode=OFFSET}
Rochester
PageRequest{page=1, size=6, mode=OFFSET}
[Sort[property=name, isAscending=true, ignoreCase=false]]
[6/27/24, 13:26:52:338 CDT] 00000051 id=7302420d enliberty.data.internal.persistence.service.DBStoreEMBuilder > createEntityManager Entry
[6/27/24, 13:26:52:338 CDT] 00000051 id=3ea89612 om.ibm.wsspi.persistence.internal.PersistenceServiceUnitImpl > createEntityManager Entry
[6/27/24, 13:26:52:339 CDT] 00000051 id=3ea89612 om.ibm.wsspi.persistence.internal.PersistenceServiceUnitImpl < createEntityManager Exit
org.eclipse.persistence.internal.jpa.EntityManagerImpl@ab3b5af
[6/27/24, 13:26:52:339 CDT] 00000051 id=7302420d enliberty.data.internal.persistence.service.DBStoreEMBuilder < createEntityManager Exit
org.eclipse.persistence.internal.jpa.EntityManagerImpl@ab3b5af
[6/27/24, 13:26:52:339 CDT] 00000051 id=00000000 io.openliberty.data.internal.persistence.RepositoryImpl 3 java.lang.IllegalArgumentException replaced with jakarta.data.exceptions.MappingException
[6/27/24, 13:26:52:339 CDT] 00000051 id=00000000 io.openliberty.data.internal.persistence.RepositoryImpl 3 Failure occurred: jakarta.data.exceptions.MappingException
[6/27/24, 13:26:52:339 CDT] 00000051 id=15d7a454 io.openliberty.data.internal.persistence.RepositoryImpl < invoke MixedRepository.locatedIn Exit
jakarta.data.exceptions.MappingException: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Internal problem encountered while compiling [ FROM Business WHERE location.address.city=?1 ORDER BY name].
Internal Exception: java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1
at io.openliberty.data.internal.persistence.RepositoryImpl.failure(RepositoryImpl.java:302)
at io.openliberty.data.internal.persistence.PageImpl.<init>(PageImpl.java:67)
at io.openliberty.data.internal.persistence.RepositoryImpl.invoke(RepositoryImpl.java:858)
at jdk.proxy11/jdk.proxy11.$Proxy84.locatedIn(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.jpa.web.MixedRepository$1687930109$Proxy$_$$_WeldClientProxy.locatedIn(Unknown Source)
at test.jakarta.data.jpa.web.DataJPATestServlet.testCountQueryWithFromAndWhereClausesOnly(DataJPATestServlet.java:496)
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: Internal problem encountered while compiling [ FROM Business WHERE location.address.city=?1 ORDER BY name].
Internal Exception: java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1
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.PageImpl.<init>(PageImpl.java:58)
... 39 more
Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 5.0.0-B02.v202404111748): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Internal problem encountered while compiling [ FROM Business WHERE location.address.city=?1 ORDER BY name].
Internal Exception: java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1
at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildUnexpectedException(HermesParser.java:215)
at org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(HermesParser.java:310)
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)
... 41 more
Caused by: java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302)
at java.base/java.util.Objects.checkIndex(Objects.java:385)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at org.eclipse.persistence.jpa.jpql.parser.AbstractPathExpression.getPath(AbstractPathExpression.java:258)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor$PathResolver.resolvePath(ExpressionBuilderVisitor.java:2476)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor$PathResolver.visitPathExpression(ExpressionBuilderVisitor.java:2675)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor$PathResolver.visit(ExpressionBuilderVisitor.java:2620)
at org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable.accept(IdentificationVariable.java:120)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor$PathResolver.visitPathExpression(ExpressionBuilderVisitor.java:2650)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor$PathResolver.visit(ExpressionBuilderVisitor.java:2620)
at org.eclipse.persistence.jpa.jpql.parser.StateFieldPathExpression.accept(StateFieldPathExpression.java:77)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.visitPathExpression(ExpressionBuilderVisitor.java:2127)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.visit(ExpressionBuilderVisitor.java:1893)
at org.eclipse.persistence.jpa.jpql.parser.StateFieldPathExpression.accept(StateFieldPathExpression.java:77)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor$ComparisonExpressionVisitor.visit(ExpressionBuilderVisitor.java:2208)
at org.eclipse.persistence.jpa.jpql.parser.AnonymousExpressionVisitor.visit(AnonymousExpressionVisitor.java:466)
at org.eclipse.persistence.jpa.jpql.parser.StateFieldPathExpression.accept(StateFieldPathExpression.java:77)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.visit(ExpressionBuilderVisitor.java:732)
at org.eclipse.persistence.jpa.jpql.parser.ComparisonExpression.accept(ComparisonExpression.java:71)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.visit(ExpressionBuilderVisitor.java:2111)
at org.eclipse.persistence.jpa.jpql.parser.WhereClause.accept(WhereClause.java:56)
at org.eclipse.persistence.internal.jpa.jpql.ExpressionBuilderVisitor.buildExpression(ExpressionBuilderVisitor.java:280)
at org.eclipse.persistence.internal.jpa.jpql.JPQLQueryContext.buildExpression(JPQLQueryContext.java:326)
at org.eclipse.persistence.internal.jpa.jpql.AbstractObjectLevelReadQueryVisitor.visit(AbstractObjectLevelReadQueryVisitor.java:226)
at org.eclipse.persistence.jpa.jpql.parser.WhereClause.accept(WhereClause.java:56)
at org.eclipse.persistence.internal.jpa.jpql.AbstractObjectLevelReadQueryVisitor.visitAbstractSelectStatement(AbstractObjectLevelReadQueryVisitor.java:292)
at org.eclipse.persistence.internal.jpa.jpql.AbstractObjectLevelReadQueryVisitor.visit(AbstractObjectLevelReadQueryVisitor.java:160)
at org.eclipse.persistence.jpa.jpql.parser.SelectStatement.accept(SelectStatement.java:100)
at org.eclipse.persistence.internal.jpa.jpql.HermesParser$DatabaseQueryVisitor.visit(HermesParser.java:440)
at org.eclipse.persistence.jpa.jpql.parser.SelectStatement.accept(SelectStatement.java:100)
at org.eclipse.persistence.internal.jpa.jpql.HermesParser$DatabaseQueryVisitor.visit(HermesParser.java:423)
at org.eclipse.persistence.jpa.jpql.parser.JPQLExpression.accept(JPQLExpression.java:186)
at org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(HermesParser.java:296)
... 47 more
The text was updated successfully, but these errors were encountered:
JPQL queries with embeddable (or relation) attributes that omit the optional entity identification variable (for consistency with JDQL) get IndexOutOfBoundsException on EclipseLink.
Example query:
Here is the exception stack with
IndexOutOfBoundsException
:The text was updated successfully, but these errors were encountered: