Comments (10)
I used the query builder for deleting with where clause
public void deleteAllMessages() { RcMessagesDao messageDao = daoSession.getRcMessagesDao(); QueryBuilder qb = messageDao.queryBuilder(); qb.where(ca.acesoft.reatchat.RcMessagesDao.Properties.Favorite.eq(false)); List messageReceived = qb.list(); messageDao.deleteInTx(messageReceived); }from greendao.
@jemshit If only that entity was affected that should work, it will clear the identity cache only for that entity. daoSesson.clear()
does it for all entities. Just have a look at the (generated) code. -ut
from greendao.
Check out DeleteQuery: http://greendao-orm.com/javadoc/greendao/de/greenrobot/dao/DeleteQuery.html
I guess that's what you are looking for?
It's not documented fully yet, because its API is likely to change a bit in the future.
from greendao.
Sorry, a better pointer would have been to QueryBuilder.buildDelete(), which returns a DeleteQuery.
from greendao.
Actually, I decided to make this feature visible in the documentation (at the end of http://greendao-orm.com/documentation/queries/).
from greendao.
Ahh great, sorry should of looked a bit harder first!
Just need to make sure I refresh my models after deleting from what I can tell?
from greendao.
Bulk deletes are currently outside of the identity scope. It depends on your app structure if special treatment is required. For example, you could consider calling DaoSession.clear() to clear identity scope.
I'd close this issue for now.
from greendao.
@mohsinraza It is magic:
ca.acesoft.reatchat.RcMessagesDao.Properties.Favorite.eq(false)
?
what this? tell me please!
Thanks
from greendao.
Is it enough to call detachAll()
on only daoObject
that deleteQuery has been executed on? Instead of daoSesson.clear()
? @greenrobot
from greendao.
Can i use the following code to delete all rows from the table
DeleteQuery<Table> tableDeleteQuery = tableDao.queryBuilder().buildDelete();
tableDeleteQuery.executeDeleteWithoutDetachingEntities();
from greendao.
Related Issues (20)
- Is there any plan for supporting gradle 7.0? HOT 2
- open software HOT 1
- incompatible gradle-6.5-bin.zip HOT 1
- Blocker issue in Sonarqube HOT 2
- Openharmony application HOT 1
- 一对多的关系表映射问题 HOT 3
- disk image is malformed (Sqlite code 11 SQLITE_CORRUPT) HOT 1
- How to do data filling, such as populating data from a database in assets into an app HOT 1
- Read this first! Check out our new database
- kotlin version problem HOT 1
- Can I use greenDao in multiple libraries? ------ Look forward to your reply HOT 1
- 什么时候支持协程 HOT 1
- Will a new version be released in the future when a bug occurs in the project? HOT 1
- DaoGenerator.getConfiguration Exception HOT 2
- Lambda 表达式报错 HOT 2
- The project encountered errors after updating Gradle Version 7.6.1 to Gradle Version 8.0+ HOT 40
- when use ’group by‘ ,the result is not expected HOT 1
- Unable to load class 'org.greenrobot.greendao.codemodifier.FormattingOptions'.
- DaoMaster class error HOT 1
- error: cannot find symbol db.execSQL("CREATE TABLE " + constraint + "\ symbol: method makeConcatWithConstants(Lookup,String,MethodType,String) location: interface StringConcatFactory HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from greendao.