Re: datanucleus.query.resultSizeMethod of "COUNT" is only valid for use with JDOQL or JPQL currently



After debugging the code I found it is going in the below flow, I ran the queries that were formed, copied them through logs and ran them at DB2, all queries executed correctly but returned no result because data was not present matching that condition. Now, when the flow returns back to our application, We cast result in "Iterable" object, when we call hasNext() it again goes into datanucleus layer and in AbstractQueryResult, query object is found to be null(Hence it throws exception, as per second stacktrace), which is strange as it was set in below stack. Maybe it got garbage collected or some other issue is there as queries were formed properly. Could you please assist or let me know in any further info needs to be furnished.

JDOQLQuery.performExecute(Map) line: 803
JDOQLQuery(Query<T>).executeQuery(Map) line: 1973
JDOQLQuery(Query<T>).executeWithMap(Map) line: 1880
ScrollableQueryResult<E>(AbstractQueryResult<E>).getSizeUsingMethod() line: 350
ScrollableQueryResult<E>.getSizeUsingMethod() line: 567
ScrollableQueryResult<E>(AbstractQueryResult<E>).size() line: 258
ScrollableQueryResult$QueryResultIterator.hasNext() line: 380
ScrollableQueryResult<E>(AbstractCollection<E>).toString() line: 466
String.valueOf(Object) line: 3450
StringBuilder.append(Object) line: 537
JDOQLQuery.performExecute(Map) line: 743
JDOQLQuery(Query<T>).executeQuery(Map) line: 1973
Query<T>.executeWithArray(Object[]) line: 1862
Query<T>.execute() line: 1844
JDOQuery<T>.executeInternal() line: 439
JDOQuery<T>.execute() line: 263
Second datanucleus touchpoint, where exceptions is thrown
ScrollableQueryResult<E>(AbstractQueryResult<E>).getSizeUsingMethod: 325
ScrollableQueryResult<E>(AbstractQueryResult<E>).size() line: 256
ScrollableQueryResult$QueryResultIterator.hasNext() line: 380

We set below extensions,
            query.addExtension( "datanucleus.rdbms.query.resultSetType", "scroll-insensitive");
            query.addExtension( "datanucleus.query.resultCacheType", cache);
            query.addExtension( "datanucleus.query.resultSizeMethod", "count");
            query.addExtension( "datanucleus.query.loadResultsAtCommit", "false");

Query: SELECT FROM MQClusterReceiverChannelJdo WHERE version_ == 0 && deleted_ == false
FetchGroup<MQClusterJdo> : 55 members=[pk_, name_], modifiable=true, postLoad=false, listeners.size=1
FetchGroup<MQClusterReceiverChannelJdo> : 56 members=[pk_, clusters_], modifiable=true, postLoad=false, listeners.size=1


Join { to automatically receive all group messages.