0

Returning from a hql query, how to check if a ScrollableResults object is empty?

scrollable.first?

Joe Taras
  • 15,166
  • 7
  • 42
  • 55
BicaBicudo
  • 307
  • 1
  • 8
  • 20

1 Answers1

0

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

Joe Taras
  • 15,166
  • 7
  • 42
  • 55