How can I remove rows from GreenDao based on a condition?
1 answer
1 Check the documentation .
2 Create a DeleteQuery for your table
3 Execute it
4 Clear the session so that all caches also lose deleted objects.
final DeleteQuery<Table> tableDeleteQuery = daoSession.queryBuilder(Table.class)
.where(TableDao.Properties.Name.eq("Value"))
.buildDelete();
tableDeleteQuery.executeDeleteWithoutDetachingEntities();
daoSession.clear();
If you need to execute the request multiple times, save the request object to avoid re-creating it.
Btw greenDAO is an ORM, not a database (here it is SQLite).
+5
source to share