-
Notifications
You must be signed in to change notification settings - Fork 10
Take First
Siim Kinks edited this page Mar 21, 2017
·
2 revisions
By default queries return parsed list of objects. For querying single parsed object, there is a takeFirst() method on the query builder API. By defining takeFirst(), during query compilation phase, LIMIT 1 clause will be added, if needed and only the first result row will be parsed.
| SQL | SqliteMagic |
|---|---|
SELECT *
FROM author
LIMIT 1;
|
import static com.siimkinks.sqlitemagic.AuthorTable.AUTHOR;
Author firstAuthor = Select
.from(AUTHOR)
.takeFirst()
.execute(); |