datanucleus / datanucleus-api-jdo

Support for DataNucleus persistence using the JDO API (JSR0012, JSR0243)
18 stars 27 forks source link

Fix for running a JDOQLTyped query with a result clause using candidate() #135

Closed mboapache closed 1 month ago

mboapache commented 1 month ago

This fixes an issue with the following JDOQLTyped query:

    JDOQLTypedQuery<Person> query = pm.newJDOQLTypedQuery(Person.class);
    query.result(false, QPerson.candidate());
    query.executeList();

With datanucleus-api-jdo 5.2.10 the above query runs into an exception:

JDOUserException: Cannot call executeList method when query has result set to mydomain.model.QPerson@a1217f9. Call executeResultList instead.

The pull request is based on branch 5.2 of datanucleus-api-jdo.

I created a GiotHub issue for the issue: https://github.com/datanucleus/datanucleus-api-jdo/issues/136. It includes a link to a test case: https://github.com/mboapache/test-jdo/tree/candidate-this