Spring batch offers two options to configure a Job Repository.
"If you get errors with the in-memory job repository and if you really don’t want to create batch tables in your database, use the persistent job repository with an in-memory database (like H2 or Derby)" - Spring Batch in Action
Can some one explain me the above lines, i.e advantage of Persistent repository with in-memory database over in-memory Repository.
Since in-memory databases are volatile, won't by having a persistent job repository with in-memory database like H2 db will make a persistent job repository behave like in-memory job repository?
The problem with the In-memory versions of JobInstanceDao, JobExecutionDao, StepExecutionDao (MapJobInstanceDao, MapJobExecutionDao, MapStepExecutionDao) is that they are not threadsafe.
So, as soon as you start to implement parallel steps, parallel chunks, etc. you will very likely run into problems sooner or later.
Therefore, if you don't want to persist your batch runtime data and wanna play safe, use an in-memory database together with the JdbcJobInstanceDao, JdbcJobExecutionDao, and JdbcStepExecutionDao.