• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

How to use Batch Process SELECT Statement in Hibernate for Native SQL  RSS feed

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Friends

When the query returns more than 1500 records , I want to chunk up the requests into multiple requests of 1500 each. How can we achieve this using Hibernate ScrollableResults or similar for native SQL query used in createSQLQuery ?

I have tried using simple technique but need more input on how we can use Hibernate ScrollableResults for Native SQL batch select records
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the setFirstResult and setMaxResults API on the JPA Query interface http://docs.oracle.com/javaee/6/api/javax/persistence/Query.html

P.S: If you are using Hibernate directly instead of JPA, you'll have to check the Hibernate API docs to see if it exposes something similar.
 
We should throw him a surprise party. It will cheer him up. We can use this tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!