Issue Details (XML | Word | Printable)

Key: NUCRDBMS-613
Type: Bug Bug
Status: Closed Closed
Resolution: Cannot Reproduce
Priority: No Testcase No Testcase
Assignee: Unassigned
Reporter: Yuzkan Mehmedali
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Store RDBMS

NPE when setting max results for a query

Created: 03/Sep/12 03:06 PM   Updated: 27/Sep/12 04:00 PM   Resolved: 24/Sep/12 08:10 PM
Component/s: Code Structure
Affects Version/s: 3.1.0.release
Fix Version/s: None

Environment:
Tapestry 5.1
jdk1.7.0_05
JTDS 1.2.6

Datastore: Microsoft SQL Server


 Description  « Hide
The code I'm trying to execute looks like this:

Query query = em.createQuery(queryString);
if (initialLoad)
{
query.setMaxResults(200);
}
else
{
query.setMaxResults(1000);
}

this.items = query.getResultList();

System.out.println("=======================> " + query);
System.out.println("=======================> " + query.getClass().getName());
System.out.println("=======================> " + this.items.size());

I'm getting an exception:
at org.datanucleus.store.rdbms.query.ForwardQueryResult$QueryResultIterator.hasNext(ForwardQueryResult.java:322)
at org.datanucleus.store.rdbms.query.ForwardQueryResult.processNumberOfResults(ForwardQueryResult.java:136)
at org.datanucleus.store.rdbms.query.ForwardQueryResult.advanceToEndOfResultSet(ForwardQueryResult.java:159)
at org.datanucleus.store.rdbms.query.ForwardQueryResult.getSizeUsingMethod(ForwardQueryResult.java:503)
at org.datanucleus.store.query.AbstractQueryResult.size(AbstractQueryResult.java:371)

If I disable the query.setMaxResults(N) lines it works and the result is not empty.

This code used to work with version 2 of datanucleus but after uprgading to 3.1.0.release it fails.

Andy Jefferson added a comment - 04/Sep/12 09:23 AM
Valid testcase as per the docs and front page of JIRA is missing.

Andy Jefferson made changes - 04/Sep/12 09:23 AM
Field Original Value New Value
Priority Major [ 3 ] Incomplete [ 6 ]
Chris Colman added a comment - 06/Sep/12 01:34 AM
Is it happening during getResultList or during this.items.size() in your System out?

It's hard to tell without a full stack trace.

Yuzkan Mehmedali added a comment - 06/Sep/12 09:10 AM
It happens during this.items.size()

Andy Jefferson added a comment - 24/Sep/12 08:10 PM
No testcase provided so no way of reproducing this. Obviously if, at some point, you follow the problem reporting guide at http://www.datanucleus.org/project/problem_jpa_testcase.html and generate a testcase that shows this then this can be reopened, but until that time will remain closed since all of our tests, and all of those in the JPA TCK don't show any such thing.

Andy Jefferson made changes - 24/Sep/12 08:10 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Cannot Reproduce [ 5 ]
Andy Jefferson made changes - 27/Sep/12 04:00 PM
Status Resolved [ 5 ] Closed [ 6 ]