I do a query that returns a list of entities. How can I retrieve the entities from a ScrollableResults
:
Session s = ....;
Query q = s.createQuery("....") # returns 100000s rows
ScrollableResults sr = q.scroll();
sr.scroll(45999); # just a number
Employee employee = ???
How do I get an employee in the last line of code
try the get(0)
method, or get()[0]
Here's a link to API: ScrollableResults
get()
returns the entire current row, get(index)
returns object at index
position without initializing the rest of them. There are also a bunch of convenience getXXX() methods that cast result to given type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With