0

I read a csv file with spring batch. I use FlatFileItemReader.

id number | score 1 | score 2 |  score 3

I need to take this line and create multiple record because the database is in this format

id number 
score

So in this example I would need to create 3 record

id number | score 1
id number | score 2
id number | score 3

Is there a way to take this line and convert it to write multiple row?

robert trudel
  • 5,283
  • 17
  • 72
  • 124
  • Does this answer your question? [Read one record/item and write multiple records/items using spring batch](https://stackoverflow.com/questions/7894445/read-one-record-item-and-write-multiple-records-items-using-spring-batch) – Mahmoud Ben Hassine Oct 06 '20 at 07:43
  • not realy, accepted answer talk about having different writer with different object. – robert trudel Oct 06 '20 at 12:21
  • In this case, you can use an item processor that transforms an input item into 3 output items. – Mahmoud Ben Hassine Oct 06 '20 at 12:42
  • @MahmoudBenHassine that mean, item processor will return a list of item? Anything special for the writer? do you have any example? – robert trudel Oct 08 '20 at 02:38
  • yes `ItemProcessor>` and `ItemWriter>`. That's what your requirement is right? I don't have an example right now, but give it a try and if you need support, you can share what you tried I will try help. – Mahmoud Ben Hassine Oct 08 '20 at 09:03

0 Answers0