HI,
I have try your function deleteAllMyType
it's functions well, the differenxces are in my class of object :
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Picture {
private static final Logger log =
Logger.getLogger(Picture.class.getName());
@PrimaryKey
private String fileName;
...
Picture doesn't extend Serializable and my key is not an id...
On 12 mar, 14:41, Pavel Byles <[email protected]> wrote:
> 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 [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.