Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass a String with more than 250 characters as job parameter in Spring Batch?

In BATCH_JOB_EXECUTION_PARAMS table, column "STRING_VAL" is defined as varchar(250). If any string longer than 250 is passed as job parameter, the database will complain that data is too long. I did some research and what some people did was to manually change the definition of the column to hold more data. Is there any side effect to store large params in the table? If so, what is the best solution to pass a large job param?

Thanks.

like image 201
X. L. Avatar asked Nov 01 '25 15:11

X. L.


1 Answers

There shouldn't be a side effect; especially, if it is a non-identifiying parameter.
But also then, the only place this could have a sideeffect is the generation of the "JOB_KEY"-field in the JOB_INSTANCE table (have a look at JdbcJobInstanceDao).
The content for this field is generated using a "JobKeyGenerator" and having a look at the used default implementation "org.springframework.batch.core.DefaultJobKeyGenerator", I don't see anything that could cause a side effect.

like image 85
Hansjoerg Wingeier Avatar answered Nov 04 '25 13:11

Hansjoerg Wingeier