New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to stream the result of a query execution #99

Closed
glassfishrobot opened this Issue Feb 21, 2015 · 6 comments

Comments

Projects
None yet
3 participants
@glassfishrobot
Contributor

glassfishrobot commented Feb 21, 2015

Reading large datasets using JPA is quite uncomfortable these days as all method signatures return {{List}}s, which causes the entire result set to be pulled into memory before it can be handed to clients. Currently users work around this by paging through the results which sort of works but is error prone regarding inserts and deletes that might touch the same set of data to be read causing inconsistencies while iterating.

It would be great if alternatives to access a Stream (on JDK 8) or an AutoCloseableIterable (on JDK 7) could be provided to lazily iterate over a result set, e.g. EntityManager.stream(…) analog to the find(…) methods as well as Query.getResultStream().

It might be worth thinking about being able to hand an eviction policy to those methods to define rules to evict managed types from the EntityManager as otherwise the persistence context will inevitably grow during the streaming operation.

@glassfishrobot

This comment has been minimized.

Show comment
Hide comment
@glassfishrobot

glassfishrobot Feb 21, 2015

Contributor

Reported by oliver.gierke

Contributor

glassfishrobot commented Feb 21, 2015

Reported by oliver.gierke

@glassfishrobot

This comment has been minimized.

Show comment
Hide comment
@glassfishrobot

glassfishrobot Feb 21, 2015

Contributor

Issue-Links:
relates to
JPA_SPEC-89

Contributor

glassfishrobot commented Feb 21, 2015

Issue-Links:
relates to
JPA_SPEC-89

@glassfishrobot

This comment has been minimized.

Show comment
Hide comment
@glassfishrobot

glassfishrobot Feb 21, 2015

Contributor

yeroc said:
Duplicate of #89?

Contributor

glassfishrobot commented Feb 21, 2015

yeroc said:
Duplicate of #89?

@glassfishrobot

This comment has been minimized.

Show comment
Hide comment
@glassfishrobot

glassfishrobot Sep 14, 2015

Contributor

@lukasj said:
not sure if duplicate but at least related; considering for 2.2

Contributor

glassfishrobot commented Sep 14, 2015

@lukasj said:
not sure if duplicate but at least related; considering for 2.2

@glassfishrobot

This comment has been minimized.

Show comment
Hide comment
@glassfishrobot

glassfishrobot May 5, 2017

Contributor

This issue was imported from java.net JIRA JPA_SPEC-99

Contributor

glassfishrobot commented May 5, 2017

This issue was imported from java.net JIRA JPA_SPEC-99

@glassfishrobot glassfishrobot added this to the 2.2 milestone May 5, 2017

hubot pushed a commit to eclipse/javax.persistence that referenced this issue May 15, 2017

[jpa-spec-99] Add ability to stream the result of a query execution
see: javaee/jpa-spec#99

Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>

@lukasj lukasj self-assigned this Jul 21, 2017

@lukasj

This comment has been minimized.

Show comment
Hide comment
@lukasj

lukasj Jul 21, 2017

Member

considering done

Member

lukasj commented Jul 21, 2017

considering done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment