JPA: what is the proper pattern for iterating over large result sets?

后端 未结 15 2547
攒了一身酷
攒了一身酷 2020-11-27 09:50

Let\'s say I have a table with millions of rows. Using JPA, what\'s the proper way to iterate over a query against that table, such that I don\'t have all an in-memo

15条回答
  •  Happy的楠姐
    2020-11-27 10:24

    You can't really do this in straight JPA, however Hibernate has support for stateless sessions and scrollable result sets.

    We routinely process billions of rows with its help.

    Here is a link to documentation: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/batch.html#batch-statelesssession

提交回复
热议问题