Search code examples
androidormsugarorm

Sugar ORM cannot bulk delete


I am using Sugar ORM in my app. It works ok except one action, that is, I cannot bulk delete.

My class is like this

public class Person extends SugarRecord<Person> {

String name;
String image;
String companyLFirst;
String companyLSecond;
String grade;
int ranking;

public Person(Context context) {
    super(context);
}

    public Person(Context context, String name, String image, String companyL1, String companyL2, String grade,
        int ranking) {
    super(context);
    setName(name);
    setCompanyL1(companyL1);
    setCompanyL2(companyL2);
    setImage(image);
    setGrade(grade);
    setRanking(ranking);
    }
//getters and setters below
}

I can save, I can listAll, but cannot deleteAll:

Person.deleteAll(Person.class);//does nothing, data is not getting deleted

Has anybody used deleteAll of Sugar ORM? Does it work actually?


Solution

  • I've used it in the example here. https://github.com/satyan/sugar/blob/master/example/src/com/example/SugarActivity.java

    It certainly does work there. Is there an error logged in the background or something to determine the cause.