DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
Issue Details (XML | Word | Printable)

Key: NUCJPA-146
Type: Bug Bug
Status: Closed Closed
Resolution: Duplicate
Priority: Major Major
Assignee: Unassigned
Reporter: Oliver Ringel
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus API JPA

JPQL TypedQuery throws NPE

Created: 14/Jul/11 11:42 PM   Updated: 13/Aug/12 03:16 PM   Resolved: 19/Jul/11 06:03 PM
Component/s: API
Affects Version/s: 3.0.0.m6
Fix Version/s: 3.0.0.release

File Attachments: 1. File testcase-datanucleus-nucjpa-146.tar (3 kB)

Datastore: Apache Derby

 Description  « Hide
Executing this TypedQuery

   List<Person> list = em.createQuery("SELECT p FROM Person p", Person.class).getResultList();

throws a NullPointerException.

Caused by: java.lang.NullPointerException
at org.datanucleus.query.QueryUtils.createResultObjectUsingDefaultConstructorAndSetters(
... 38 more

Executing the same JPQL statement as an untyped Query together with a cast works.

   List<Person> list = (List<Person>) em.createQuery("SELECT p FROM Person p").getResultList();

It seems that in case of a typed Query the selection of an entity field is required, for example the following query
also works.

   List<String> list = em.createQuery("SELECT FROM Person p", String.class).getResultList();

Oliver Ringel added a comment - 14/Jul/11 11:52 PM

Oliver Ringel made changes - 14/Jul/11 11:52 PM
Field Original Value New Value
Attachment testcase-datanucleus-nucjpa-146.tar [ 11477 ]

Andy Jefferson made changes - 19/Jul/11 06:03 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.0.0.release [ 11072 ]
Resolution Duplicate [ 3 ]
Andy Jefferson made changes - 01/Aug/11 05:13 PM
Status Resolved [ 5 ] Closed [ 6 ]
Chris Rued added a comment - 23/Feb/12 06:27 PM
I'm getting a similar problem using MongoDB as a datastore:

at org.datanucleus.query.evaluator.JavaQueryEvaluator.execute(
at org.datanucleus.api.jpa.JPAQuery.getResultList(

Should I file this as a separate issue?

Andy Jefferson added a comment - 23/Feb/12 07:49 PM
This was an issue in the RDBMS plugin (only) so yours is totally unrelated, hence raise anything on the plugin (Mongodb) it relates to ... with testcase of course. In your case you're using in-memory evaluation so it may get moved to that, but just raise for MongoDB

Andy Jefferson made changes - 13/Aug/12 03:16 PM
Component/s Queries [ 10180 ]