After a batchSave, deleteAll( Person.class ) throws a Exception:
Example
// Empresa class implements Persistable and JSONAble interfaces
Empresa emp = new Empresa();
for(int i=0; i<total; i++){
emp.fromJSON(lista.getJSONObject(i));
pm.save(emp);
}
// works fine, but when I have to update the Empresa's list from server
// first I delete all, then the error occurs
PersistableManager.getInstance().deleteAll( Empresa.class );
// I've tried this too
PersistableManager.getInstance().deleteAll( Class.forName("br.com.company.project.persistable.Empresa") );
If I do a simple "save", it works fine, but as I have a lot of Empresa objects, it's getting too slow to save all objects
Best regards
this is the code I've tried, sorry for the wrong entry..
This code doenst work too:
// Empresa class implements Persistable and JSONAble interfaces
pm.setProperty(PersistableManager.BATCH_MODE, Boolean.TRUE);
Empresa emp = new Empresa();
for(int i=0; i<total; i++){
emp.fromJSON(lista.getJSONObject(i));
pm.batchSave(emp);
}
pm.setProperty(PersistableManager.BATCH_MODE, Boolean.FALSE);
// works fine, but when I have to update the Empresa's list from server
// first I delete all, then the error occurs
PersistableManager.getInstance().deleteAll( Empresa.class );