When I have 20 rows (id = 5.......id=25) I want to get 3 first rows starting from id=4 (meaning row 5, row 6 and row 7)
I thought that I can use :
String queryStr = "FROM MyQueue x";
Query q = DbHandler.createQuery(queryStr);
q.setFirstResult(idToStart);
q.setMaxResults(maxRecords);
but the setFirstResult is counting the number of the row and not the id.
Another thing was to do it using "WHERE id > 4"
- but how can I promise that it will take the needed rows, and not some others like row 17...