Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why QueryResultIterator#getCursor() return null in GAE/J

The getCursor() javadoc said:

Returns: a Cursor or null if this query result cannot be resumed

What does the word "resumed" mean in the context?

My code is like below:

        com.googlecode.objectify.cmd.Query q = createQuery();
        QueryResultIterator<T> itr = q.iterator();
        while( itr.hasNext() )
        {
            list.add( itr.next() );
        } 
        ... 
       String newCursorValue = itr.getCursor().toWebSafeString();

It throws NPE just because itr.getCursor() is emtpy. This method works well for a long time but fails today when i modify the Query condition(but it is valid). But i can't see why the query condition can affect the getCursor() method.

Anybody please shed some light? By the way i use GAE/J v1.7.1, Objectify 4a3.

like image 880
Mike Avatar asked Jan 31 '26 07:01

Mike


1 Answers

You should read about limitations of cursors. This basically defines when query can be "resumed".

like image 106
Peter Knego Avatar answered Feb 01 '26 20:02

Peter Knego



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!