5

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.

Janusz
  • 187,060
  • 113
  • 301
  • 369

1 Answers1

14

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

mmlooloo
  • 18,937
  • 5
  • 45
  • 64