Skip to content
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 iterable JDBC template to process large amount of data [SPR-13900] #18474

Closed
spring-projects-issues opened this issue Jan 28, 2016 · 4 comments
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jan 28, 2016

Michael Osipov opened SPR-13900 and commented

I have a usecase where I need to write a table with millions of rows to an output stream via HTTP. Those data cannot be reasonably fetched with the current JdbcTemplate. One would need an abstracted iterator which does all the nice stuff JdbcTemplate but does not spill memory.

Fortunately, there is springjdbc-iterable but the author is not maintaining it anymore. I have requested to donate this code to Spring core to have this by default.


Affects: 4.2.4

Issue Links:

1 votes, 2 watchers

@alpet
Copy link

alpet commented Apr 7, 2019

What is the status on this one ? Is been two years have the plans changed ?

@denniseffing
Copy link

Could this be prioritized higher for future releases?

We realized last week that Spring Data JDBC is not capable of streaming large result sets and we are encountering the first memory issues because of this.

@jhoeller
Copy link
Contributor

Talking to the Spring Data team, we're aiming for an arrangement in the Spring Framework 5.3 timeframe now, with iterable methods on JdbcTemplate and NamedParameterJdbcTemplate built on a CloseableIterator or on Stream, to be picked up by Spring Data JDBC right away.

@jhoeller jhoeller modified the milestones: 5.x Backlog, 5.3 M1 May 14, 2020
@jhoeller jhoeller self-assigned this May 14, 2020
@jhoeller
Copy link
Contributor

A first cut of this is ready now, introducing queryForStream methods on JdbcTemplate and NamedParameterJdbcTemplate, all with a RowMapper argument and a closeable Stream result (ideally to be used with a try-with-resources clause). Feel free to give it a try with the upcoming 5.3 snapshot, or with the 5.3 M1 release in June...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants