When I am trying to disable Spring Batch Metadata creation with the option spring.batch.initialize-schema=never
and then I launch batch, nothing happen and the batch terminate immediately without running the related jobs.
In the other hand when I am trying to enable the Metadata creation, the batch work fine, I am getting the classic SERIALIZED_CONTEXT
field size error. I can't always save 4GB of data in the table when I execute the batch.
How to disable definitively the Metadata creation, and have my batch still working?
Edit : I think I found a kind of solution to avoid this issue, and I would like to have your point of view. I am finally working with Metadata generation. The issue occurs when you have large set of data stored in your ExecutionContext you pass between Tasklets
(we all know this is the reason). In my case it is an ArrayList
of elements (POJO), retrieved from a CSV
file with OpenCSV
. To overcome this issue I have :
- reduced the number of columns and lines in the
ArrayList
(becauseSpring Batch
will serialize thisArrayList
in theSERIALIZED_CONTEXT
field. The more columns and lines you have the more you are sure to get this issue) - changed the type of the
SERIALIZED_CONTEXT
fromTEXT
toLONGTEXT
- deleted the
toString()
method defined in the POJO (not sure it really helps)
But I am still wondering, what if you have no choice and you have to load all your columns, what is the best way to prevent this issue?