Try this :
Query query = pm.newQuery(YourThing.class);
query.setRange(0,300);
List< YourThing > results = (List< YourThing >) query.execute();
Iterator iter = results.iterator();
while(iter.hasNext()){
YourThing p = (YourThing)iter.next();
pm.deletePersistent(p);
}
pm.close();
This will delete 301 entries at a time(Around the maximum you can do
within 30s time limit).
Call this multiple times to delete all entries. (Worked for me.)
On Sep 20, 6:13 am, "??" <[email protected]> wrote:
> How to delete data from GAE for Java?
>
> I have tried:
>
> 1) logging into the app engine admin, going to do some GQL
> --> fail, don't know the syntax
> 2) searching for information on GQL regarding DELETE
> --> fail, can't find any syntax for delete, don't know if it can even
> do it
> 3) writing Query query = pm.newQuery(MyTerriblyUnscalableThing.class);
> query.deletePersistentAll();
> --> fail, some error about timing out (are you kidding me? yes this is
> real scale.)
> 4) writing Query query = pm.newQuery(Person.class);
> query.setFilter("Id > 0");
> query.deletePersistentAll();
> --> fail, cannot be zero or something
> 5) writing Query query = pm.newQuery(Person.class);
> query.setFilter("timestamp == 0");
> --> fail, String cast to Long or something (guess I am too dumb)
> 6) search Google internet
> --> fail, signal noise ratio is asymzero
> 7) search Google forums
> --> fail, huh?
>
> Can anyone explain to me how to do the equivalent of a DROP TABLE in
> GAE for Java?
> Yes I know it is not a table, I am just trying to remove all the
> entities of a specific class.
> Am I missing something?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---