L. Swifter
L. Swifter

Reputation: 3237

GreenDao how to update table by other column (not the primary key id)?

I know I can use these code to update the table, but it use the primary key id for comparison.

DaoSession daoSession = ((App) getApplication()).getDaoSession();
StudentDao studentDao = daoSession.getStudentDao();
studentDao.update(studentBean);   //update by id

But sometimes, I need to use other column to update the table, it maybe like:

UPDATE STUDENT_TABLE SET ADDRESS = 'Texas' WHERE NAME = 'David';

How to implement the above sql statement with greendao?

Upvotes: 0

Views: 46

Answers (0)

Related Questions