I'm trying to use JOOQ for paginating results from Mysql DB, I want to request my MySQL DB for a specific offset.
My Clients are requesting different sizes of results with different offsets and my service is stateless.
I don't want to use limit and offset since I know they have a bad performance.
public void fetch() {
Cursor<Record> cursor = null;
String query = "books WHERE type = 'KIDS'";
try {
cursor = create.selectFrom(query).fetchLazy();
while (cursor.hasNext()) {
Record book = cursor.fetchNext();
}
}
finally {
if (cursor != null) {
cursor.close();
}
}
}
How can I start from page 5 or from books 1000 to 1100?
Best Regards, Matan