1

I want to create a spring-batch job, which will save data into SQL Server tables, but I want to run it without any meta data database persistence. Unfortunately spring-batch requires to write metadata information of job execution.

I don't want those BATCH table to be created. How can I do this.

1

1 Answer 1

1

Those tables are required for proper functioning of the spring-batch framework features, so I don't think its a good idea. However Spring does provide a in-memory solution.

The JobRepository has a few Dao classes. Eg. JobInstanceDao, JobExecutionDao etc. All of these by default use the JDBC implementation. But Spring also provides a in-memory implementation for these eg. MapJobInstanceDao for JobInstanceDao. You can easily inject these through the constructor of SimpleJobRepository.

Sign up to request clarification or add additional context in comments.

8 Comments

I have tried MapJobRepositoryFactoryBean but in that case I am using ResourcelessTransactionManager which is causing issue. I am not being able to save data after that.
Seems like you are using the same transaction manager globally ? Make sure the ResourcelessTransactionManager is not picked up by the business logic classes.
How to have separate transaction manager for JPA repository. I tried using @Transactional at service layer but it did not help.
I am sure you already have some transaction manager setup. Keep it as is. Define a bean of ResourcelessTransactionManager and pass it into the MapJobRepositoryFactoryBean only. Unless I am missing something this should work.
ResourcelessTransactionManager is basically a no-op transaction manager. Using this essentially means dropping support of transactions.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.