openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Lee (JIRA)" <>
Subject [jira] [Updated] (OPENJPA-2502) NPE in QueryKey.createKey using criteria with QueryCache enabled
Date Sun, 18 May 2014 05:04:14 GMT


Albert Lee updated OPENJPA-2502:

    Attachment: OPENJPA-2502.221x.patch

The NPE is caused by the CriteriaExpressionBuilder trying to find the metadata for the join
fetch field.  Since this field is mostly a collection, the metadata class is of collection
type, hence there is no metadata in the repository, hence a null is stored in the metas array.
 Subsequently, when the metas array is processed the NPE is surfaced.

I tried the equivalent JPQL as the criteria API and the JPQLExpressionBuilder does not include
any metadata for the fetch clause.

> NPE in QueryKey.createKey using criteria with QueryCache enabled
> ----------------------------------------------------------------
>                 Key: OPENJPA-2502
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: criteria, datacache
>    Affects Versions: 2.2.1, 2.2.2
>            Reporter: Albert Lee
>         Attachments: OPENJPA-2502.221x.patch,
> Running an example in the spec using Criteria API with "left join fetch" AND query cache
enabled yield the following NPE exception. See the testcase to reproduce the problem and the
spec section where the example comes from:
> <openjpa- nonfatal user error> org.apache.openjpa.persistence.ArgumentException:
Failed to execute query "null". Check the query syntax for correctness. See nested exception
for details.
> 	at org.apache.openjpa.kernel.QueryImpl.execute(
> 	at org.apache.openjpa.kernel.QueryImpl.execute(
> 	at org.apache.openjpa.kernel.DelegatingQuery.execute(
> 	at org.apache.openjpa.persistence.QueryImpl.execute(
> 	at org.apache.openjpa.persistence.QueryImpl.getResultList(
> 	at
> 	at test.TestNPE.test(
> ......
> Caused by: java.lang.NullPointerException
> 	at org.apache.openjpa.datacache.QueryKey.createKey(
> 	at org.apache.openjpa.datacache.QueryKey.newInstance(
> 	at org.apache.openjpa.datacache.QueryCacheStoreQuery$QueryCacheExecutor.executeQuery(
> 	at org.apache.openjpa.kernel.QueryImpl.execute(
> 	at org.apache.openjpa.kernel.QueryImpl.execute(
> 	... 33 more

This message was sent by Atlassian JIRA

View raw message