1

The Reader we have written uses a DAO to query the database based on some parms and returns a list of Objects List<> . But the FlatFilewrite for some reason fails as its is unable to map the field names . Further debugging I feel that the Write is unable to accept the List or Reader is sending a List> . Please let us know how to handle the same .

org.springframework.beans.NotReadablePropertyException: Invalid property 'costCenter' of bean class [java.util.ArrayList]: Bean property 'costCenter' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?

My code is same as the below , xcept the reader is a custom one with a DAO and returns a list . http://websystique.com/springbatch/spring-batch-read-from-mysql-database-and-write-to-a-csv-file/

Fancy
  • 11
  • 1
  • 4

1 Answers1

1

You can wrap your FlatFileItemWriter in a delegating writer that unpacks and combines the lists then passes them on. This old answer contains an example that should work.

Community
  • 1
  • 1
Dean Clark
  • 3,770
  • 1
  • 11
  • 26