NullPointerException in Query.setHint with join-fetch/batch [message #757300] |
Thu, 17 November 2011 15:31 |
Sven Hoffmann Messages: 18 Registered: July 2009 |
Junior Member |
|
|
Sometimes a NullPointerException occures while creating a JPA query with query hint eclipselink.join-fetch/eclipselink.batch.
The code performing the query looks like:
Query query = em.createNamedQuery(Container.LOAD_BY_ORDER);
query.setParameter("orderId", id);
query.setHint(QueryHints.FETCH, "c.attribute1");
query.setHint(QueryHints.BATCH, "c.attribute3");
List result = query.getResultList();
The stacktrace of the exception is:
java.lang.NullPointerException
at org.eclipse.persistence.internal.expressions.ObjectExpression.existingDerivedExpressionNamed(ObjectExpression.java:254)
at org.eclipse.persistence.internal.expressions.ObjectExpression.derivedExpressionNamed(ObjectExpression.java:223)
at org.eclipse.persistence.internal.expressions.ObjectExpression.get(ObjectExpression.java:267)
at org.eclipse.persistence.expressions.Expression.get(Expression.java:1529)
at org.eclipse.persistence.internal.jpa.QueryHintsHandler$FetchHint.applyToDatabaseQuery(QueryHintsHandler.java:1376)
at org.eclipse.persistence.internal.jpa.QueryHintsHandler$Hint.apply(QueryHintsHandler.java:361)
at org.eclipse.persistence.internal.jpa.QueryHintsHandler$Hint.apply(QueryHintsHandler.java:339)
at org.eclipse.persistence.internal.jpa.QueryHintsHandler.apply(QueryHintsHandler.java:171)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setHintInternal(EJBQueryImpl.java:1021)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setHint(EJBQueryImpl.java:1003)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setHint(EJBQueryImpl.java:81)
...
The application uses EclipseLink 2.3.1 M8 and is hosted on WebSphere Application Server 7.0 FP17 on an AIX system. The query is concurrently performed by message driven beans.
After one failure all subsequent calls fail with the same exception until the server is restarted.
I've found a similar issue described in NullPointerException in QueryKeyExpression.getQueryKeyOrNull.
It is possible to avoid this exception e.g. by JPA configuration (disable expression cache) or is a fix available?
[Updated on: Sat, 19 November 2011 17:24] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03485 seconds