Only Institute
to provide recording daily after class to students. you can practice whole day under faculty guidance. where test and mockup tests are taken regularly. provides all mobile nos of old students on website.

Hibernate ScrollableResults and ScrollMode Example

On this page, we will provide Hibernate ScrollableResults and ScrollMode example. ScrollableResults is used to scroll large amount of data and ScrollMode provides different modes such as scrolling only in forward direction and sensitive/insensitive to changes in underlying data. ScrollableResults can be used to paginate large amount of data because it provides methods to change current location for row iteration. Here I will provide ScrollableResults examples using createCriteria(), createQuery() and createSQLQuery() of org.hibernate.Session.
  • org.hibernate.ScrollableResults scrolls results by the given increments. The columns of the results start from zero. Find some methods of ScrollableResults.
  • scroll(int i) : Scrolls the results. i represents the number for forward or backward scrolling.
  • setRowNumber(int rowNumber) : It sets the current location in ScrollableResults.
  • get(int i) : Gets the object at index i in current row..
  • get() : It returns the array of Object of current row.s
  • afterLast() : It sets the location just after the last result.
  • beforeFirst() : It sets the location just before the first result.
  • org.hibernate.ScrollMode is an Enum which provides the different mode to fetch ScrollableResults.
  • FORWARD_ONLY : It requests ScrollableResults that scrolls forward only.
  • SCROLL_SENSITIVE : ScrollableResults that is sensitive to changes in underlying data.
  • SCROLL_INSENSITIVE : Insensitive to changes in underlying data.