springspring-batch

Spring Batch Passing list of values as a parameter


I want to pass list of id's as one of parameter to Spring batch. Is this possible to achieve?

Thanks in advance.


Solution

  • What you are trying to do is not possible.

    From the JobParameter doc:

    Domain representation of a parameter to a batch job. Only the following types can be parameters: String, Long, Date, and Double. The identifying flag is used to indicate if the parameter is to be used as part of the identification of a job instance.

    You might be tempted write your list of of id's to a comma delimited string and pass that as a single parameter but beware that when stored in the DB it has a length of at most 250 bytes. You'll either have to increase that limit or use another way.

    Perhaps you can explain what why you need to pass that list of ids.