• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Amit Basnak
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
 
Jaikiran Pai
Sheriff
Posts: 10447
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!