Combine rows from 2 files and write to DB using Spring Batch

戏子无情 提交于 2019-12-24 01:16:16

问题


I have File1.csv, with the columns id,name,age. File2.csv has the columns id,designation. In both the files ID refers to same value and is unique. Sample data File1.csv

id    name    age
101   abc     30
102   def     25

File2.csv

id     designation
101    manager
102    Assistant manager

Spring batch should read the files simultaneously, combine the data and write to DB as below

id   name    age   designation
101  abc     30     manager
102  def     25     Assistant manager

How to read 2 files simultaneously in spring batch?


回答1:


You have to implement a Reader that merges the two files togehter.

Have a look at my answer here Aggregating processor or aggregating reader

where I have linked to other answers to a similar question



来源:https://stackoverflow.com/questions/40760001/combine-rows-from-2-files-and-write-to-db-using-spring-batch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!