I'm trying to delete all entities in my datastore but I receive the
following error:

javax.jdo.JDOUserException: One or more instances could not be deleted...
NestedThrowablesStackTrace:
java.lang.IllegalArgumentException: id cannot be zero...

Caused by:java.lang.IllegalArgumentException: id cannot be zero....


For the following code:

  public void deleteAllMyType() {
    PersistenceManager pm = PMF.get().getPersistenceManager();
    Query query = pm.newQuery(MyType.class);
    try {
      query.deletePersistentAll();
      //List<MyType> clist = (List<MyType>) query.execute();
      //pm.deletePersistentAll(clist); // This doesn't work either
    } finally {
      query.closeAll();
      pm.close();
    }
  }

My entity class looks like this:

@PersistenceCapable(identityType = IdentityType.APPLICATION)//, detachable =
"false")
public class MyType implements Serializable {
  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  private Long id;

  @Persistent
  private String name;
  .
  .
  .
}

-- 
-Pav

-- 
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 google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to