Home » Android » android – How can get top of records by GreenDAO?

android – How can get top of records by GreenDAO?

Posted by: admin June 15, 2020 Leave a comment

Questions:

I wanna to get top some records from my table, but GreenDAO doesn’t provide it.
Like this:

SELECT TOP 1 * FROM table_name

In LINQ you can get top of records with Take(), is there any solution for GreenDAO?

Could every one offer a suggestion?

How to&Answers:

You can specify a limit using standard QueryBuilder:

List<YourEntity> entities = yourDao.queryBuilder().limit(1).list();