Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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

 
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!