I'm created Data Class and store data using PersistenceManager, but later I edited my Data Class and now i have problem with share data I'm trying delete this objects (pm.deletePersistent(e)) but I'have exception :
javax.jdo.JDOUserException: One or more instances could not be deleted NestedThrowables: org.datanucleus.jdo.exceptions.ClassNotPersistenceCapableException: The class "The class "java.lang.Class" 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
that's my Data Class :
import com.google.appengine.api.datastore.Key;
import java.util.ArrayList;
import java.util.Date;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
@PersistenceCapable
public class Task {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent
private String author;
@Persistent
private String task;
@Persistent
private Date date;
@Persistent
private String note;
@Persistent
private ArrayList<String> label;
@Persistent
private int numberoflist;
public Task (String author, String task,String note, Date date, int numberoflist)
{
this.author=author;
this.task=task;
this.date=date;
this.numberoflist=numberoflist;
this.note=note;
}
that's my .jsp file, but deletePersistentAll(Task.class) or pm.deletePersistent(e) doesn't work because class Task has changed (one field changed type from User to String)
try{
PersistenceManager pm = PMF.get().getPersistenceManager();
pm.flush();
Query query = pm.newQuery(Task.class);
query.declareParameters("String authorParam");
List<Task> results = (List<Task>) query.execute("user@mail");
try
{
if (results.iterator().hasNext())
{
for (Task e : results)
{
pm.deletePersistent(e);
%>
<p><%= e.getTask() %> </p>
<%
}
}else
{
%>
<p>Empty</p>
<%
}
} finally {
query.closeAll();}
pm.close();
}catch(Exception ex) {...}
exception : java.lang.ClassCastException: java.lang.String cannot be cast to com.google.appengine.api.users.User
what shoud I do to clear all data from PersistenceManager?
plz help