Efficient way to query database from a program processing big list of items
I have a spring batch program with itemReader, itemProcessor and itemWriter.
Say I have 10,000 records to process. For each item I want to fetch data 开发者_高级运维from several database table for deciding some conditions and adding some data.
I believe this will be done during processing.
Question: What is the best design to do this ? I am bit skeptic about running several Select queries for each item injecting SimpleJdbcTemplate in itemProcessor. Is there any other efficient way to do this ??
Thanks in advance!! Nik
Perhaps you should insert the 10,000 "POJOs" into a table in the datanbase, and then run a query that joins that to the other tables?
精彩评论