I've used the following code, to limited success...
<code>
<%@ page import="com.google.appengine.api.datastore.DatastoreService"
%>
<%@ page
import="com.google.appengine.api.datastore.DatastoreServiceFactory" %>
<%@ page import="com.google.appengine.api.datastore.Entity" %>
<%@ page import="com.google.appengine.api.datastore.PreparedQuery" %>
<%@ page import="com.google.appengine.api.datastore.Query" %>
<%@ page import="java.lang.Iterable" %>
<%
DatastoreService datastore =
DatastoreServiceFactory.getDatastoreService();
PreparedQuery global = datastore.prepare(new Query("__Stat_Kind__"));
for( Entity globalStat : global.asIterable() )
{
Long totalBytes = (Long) globalStat.getProperty("bytes");
Long totalEntities = (Long) globalStat.getProperty("count");
String kindName = (String) globalStat.getProperty("kind_name");
%><%= "[" + kindName + "] has " + totalEntities + " entities and
takes up " + totalBytes + "bytes<br/>" %><%
} // end for
%>
</code>
This works to a point. It seems I only shows that I have one entry for
my POJO when I know I have thousands. Perhaps the statistics aren't
updated for extended periods as I've seen on other threads. Hope this
helps you get all your kinds in one pass...
Erich
On May 20, 9:33 am, Laco Skokan <[email protected]> wrote:
> I have tried both. On local it does not work at all as you say. On
> cloud it works, but I have to specify entity name, so I can't list all
> entities.
>
> L.
>
> On 20 kvě, 06:15, Didier Durand <[email protected]> wrote:
>
>
>
> > Hi Ladislav
>
> > Did you try on GAE itself or on your local dev server: stats don't
> > work locally
>
> > seehttp://groups.google.com/group/google-appengine-java/browse_thread/th...
> > orhttp://groups.google.com/group/google-appengine-java/browse_thread/th...
>
> > cheers
> > didier
>
> > On May 18, 10:06 pm, Laco Skokan <[email protected]> wrote:
>
> > > I have tried, but it does not. I have ro specify "kind_name" as a
> > > parameter. But I want to list all kinds. If I do not specify the
> > > parameter, the stat returns null.
>
> > > Ladislav.
>
> > > On 18 kvě, 11:16, Didier Durand <[email protected]> wrote:
>
> > > > Hi,
>
> > > > did you try the sample code
> > > > athttp://code.google.com/appengine/docs/java/datastore/stats.html
> > > > with __Stat_Kind__ ? Should do what you want.
>
> > > > didier
>
> > > > On May 17, 10:51 pm, Laco Skokan <[email protected]> wrote:
>
> > > > > Hello,
>
> > > > > did anybody tried to list all entity kinds from thedatastore? How can
> > > > > this be done?
> > > > > I try to useDatastorestatistics, but it does not seems to be useful
> > > > > for this task.
>
> > > > > Any ideas? Thank you, Ladislav.
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > > > Groups "Google App Engine for Java" group.
> > > > > To post to this group, send email to
> > > > > [email protected].
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected].
> > > > > For more options, visit this group
> > > > > athttp://groups.google.com/group/google-appengine-java?hl=en.
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Google App Engine for Java" group.
> > > > To post to this group, send email to
> > > > [email protected].
> > > > To unsubscribe from this group, send email to
> > > > [email protected].
> > > > For more options, visit this group
> > > > athttp://groups.google.com/group/google-appengine-java?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Google App Engine for Java" group.
> > > To post to this group, send email to
> > > [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected].
> > > For more options, visit this group
> > > athttp://groups.google.com/group/google-appengine-java?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine for Java" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group
> > athttp://groups.google.com/group/google-appengine-java?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group
> athttp://groups.google.com/group/google-appengine-java?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.