Search code examples
androidsugarorm

Bulk operation does not work on Sugar ORM


I'm using Sugar ORM and i want to delete all the table that I'm using but that doesn't work and dont show any error in the log file:

Here is my modele:

 private String name;
private String lastName;
private String imgSoc;
private Boolean follow;
private String adresse;
private String site;
private int numOffres;

public Society( String name, String lastName, 
        String imgSoc, Boolean follow, String adresse, String site,
        int numOffres) {


    this.name = name;
    this.lastName = lastName;
    this.imgSoc = imgSoc;
    this.follow = follow;
    this.adresse = adresse;
    this.site = site;
    this.numOffres = numOffres;
}

and the commande :

   Society.deleteAll(Society.class);

Solution

  • To do a bulk delete, you have to instantiate the class with and select the records to remove. If you want to remove all, it looks something like this:

    List<Society> items = Society.listAll(Society.class);
    Society.deleteAll(Society.class);
    

    Original documenation: http://satyan.github.io/sugar/getting-started.html