atom feed11 messages in com.googlegroups.google-appengine-javaRe: PreparedQuery.countEntities() cla...
FromSent OnAttachments
PionOct 30, 2009 10:07 am 
Yasuo HigaOct 30, 2009 4:13 pm 
PionOct 30, 2009 4:43 pm 
PionOct 30, 2009 5:32 pm 
Yasuo HigaOct 30, 2009 5:55 pm 
PionOct 30, 2009 6:14 pm 
Yasuo HigaOct 30, 2009 6:44 pm 
PionOct 30, 2009 6:58 pm 
PionOct 31, 2009 10:34 am 
PionOct 31, 2009 10:34 am 
Jason (Google)Nov 3, 2009 11:32 am 
Subject:Re: PreparedQuery.countEntities() clarifications
From:Pion ("onl@gmail.com)
Date:Oct 30, 2009 6:14:10 pm
List:com.googlegroups.google-appengine-java

I have just made the changes per your suggestion below.

It still returns 6218 entities while The Admin Console -> Datastore -> Statistic shows 5029.

Thanks.

On Oct 30, 5:55 pm, Yasuo Higa <higa@gmail.com> wrote:

Hi Pion,

// Version 3 - This code works on both (deployed) App Engine and Development server // But The Admin Console -> Datastore -> Statistic shows that it has about 5,000 entities // This code returns about 6,0000 entities                Query query = new Query(kind);                query.setKeysOnly();                FetchOptions fetchOptions = FetchOptions.Builder.withOffset(0);

How about: FetchOptions fetchOptions =     FetchOptions.Builder.withOffset(0).limit(Integer.MAX_VALUE);

Instead of:  FetchOptions fetchOptions = FetchOptions.Builder.withOffset(0);

               PreparedQuery preparedQuery = datastore.prepare(query);                int result = preparedQuery.asList(fetchOptions).size();

       logger.info(Integer.toString(result));

               return result;        }

Hope this helps,