Skip to content

Java 8 Stream on JpaSpecificationExecutor with @QueryHint fetchSize support [DATAJPA-1438] #1752

Closed
@spring-projects-issues

Description

@spring-projects-issues

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

Metadata

Metadata

Labels

in: coreIssues in core supportstatus: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions