Oliv
Oliv

Reputation: 10822

Iterate JPA query result

Is there a way to iterate query results through JPA API, similar to Hibernate's Criteria.scroll() method? It is big performance improvement with big resultsets, rows can be processed as they are read.

Upvotes: 1

Views: 333

Answers (1)

Mikko Maunu
Mikko Maunu

Reputation: 42114

No, there is not such a construct in JPA. Also not in JPA 2.1.

JPA 2.2 provides TypedQuery.getResultStream(), but default implementation does not have expected effect (calls getResultList). Also specific implementations do not always lead to performance improvements, as can be seen in this article.

Upvotes: 1

Related Questions