I want to delete all the instances of type X in my datastore.  I can't
do this via the console because there are about 2000 of them.

The AppEngine documentation suggests this:
"To delete multiple objects in JDO, call the deletePersistentAll(...)
method with a Collection of objects. This method will use a single low-
level batch delete operation that is more efficient than a series of
individual deletePersistent(...) invocations"

It also tells us how to use extents.   As I understand, an extent is a
collection of the persistent objects.   I then tried putting the two
together:

pm.deletePersistentAll(pm.getExtent(Student.class, false));

but I got this error:
The class "The class "org.datanucleus.jdo.JDOExtent" is not
persistable. This means that it either hasnt been enhanced, or that
the enhanced version of the file is not in the CLASSPATH (or is hidden
by an unenhanced version), or the Meta-Data/annotations for the class
are not found." is not persistable. This means that it either hasnt
been enhanced, or that the enhanced version of the file is not in the
CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data
for the class is not found.

This confused me, because I didn't realise that the collection of
deletables must itself be persistent.   I then tried copying the
objects from the extent into an ArrayList<Student> collection, and I
passed that to "pm.deletePersistentAll()".   That worked, despite the
fact that this ArrayList is not persistent.   I'm happy that I have a
workaround, however:

(a) for my understanding I'd like to know why some collections work
and others don't;
(b) I'd like to add my vote to Google adding some easy facility for
deleting all objects of a certain Kind, or even the entire datastore,
for the development phase of a project....this sort of thing is easier
to do in MySQL.

--

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.


Reply via email to