Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I load all fields from a database and sort the result after one row with GreenDao?

I want to load all entities from a sqlite database with greendao and sort the result.

I can load all entities with loadAll but this doesn't gives me a guarantee about the sorting of the resulting list.

like image 708
Janusz Avatar asked Dec 29 '14 09:12

Janusz


1 Answers

Use queryBiulder like below:

List joes = userDao.queryBuilder().where(Properties.FirstName.eq("Joe")).orderAsc(Properties.LastName).list();

for all rows:

List joes = userDao.queryBuilder().orderAsc(Properties.LastName).list();

Source

like image 96
mmlooloo Avatar answered Nov 05 '22 19:11

mmlooloo