Returning from a hql
query, how to check if a ScrollableResults
object is empty?
scrollable.first
?
Returning from a hql
query, how to check if a ScrollableResults
object is empty?
scrollable.first
?
ScrollableResults
object has a method first()
first() returns boolean value.
TRUE
if exists the first element, FALSE
otherwise
A possible check you can implement is:
ScrollableResults myScrollable ...
if (myScrollable != null && myScrollable.first()) {
// add your business logic
}
You can see here