Closed
Description
László Csatlós opened DATAJPA-1438 and commented
Actual method findAll(Specification<T> spec)
on interface JpaSpecificationExecutor<T>
can return only with List
or Page
but not with Stream<T>
.
This would be useful for huge resultSets combined with @QueryHint(name="org.hibernate.fetchSize", value="50" )
to truly benefit the power of streaming concept and not to exhaust all of the JVM memory. Hibernate already has the capability to do this with ScrollableResults
:
Query query = session.createQuery(query);
query.setReadOnly(true);
query.setFetchSize(100);
ScrollableResults results = query.scroll(ScrollMode.FORWARD_ONLY);
If ambiguous method name is a problem (mentioned at DATAJPA-906), then a
Stream<T> streamAll(Specification<T> spec, Long fetchSize)
signiture would also perfect
2 votes, 3 watchers