I want to implement pagination, But I do not want to do a full DBScan every time I execute the same query (this DBcall is done as API).
So far, for pagination I am using TypedQuery in java and setting starting row and pageSize to fetch records.
But the thing is I am confused with how JPA runs queries internally, I think that TypedQuery first executes the query and then sends me a subset of result I want. If so, then is there any way keep track of last processed ResultSet and send it back to response and then use it again do a resultSet.next() next time we hit this API again ?
Or is there any other way to achieve this?
while( resultSet in not null)
resultSet = API call to DB with pageSize