Reputation: 97
I am trying to launch a job with JobLauncher with below code
@RestController
public class SystemController
{
static Logger logger = LoggerFactory.getLogger(SystemController.class);
JobExecution jobExecution;
@Autowired
JobLauncher jobLauncher;
@Autowired
Job job;
@RequestMapping(value ="/abccontext" ,method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public String handleResquest(@RequestBody final Data resData)
throws Exception
{
JobParameters parameters = new JobParametersBuilder().addString("date", dateFormat.format(date)).addLong("time", Long.valueOf(System.currentTimeMillis())).toJobParameters();
jobLauncher.run(job, parameters);
}
}
i have configured job with same id in batchjob.xml
<job id="job">
// steps
</job>
some time I have received below mention error msg
PreparedStatementCallback; SQL [INSERT into BATCH_JOB_INSTANCE(JOB_INSTANCE_ID, JOB_NAME, JOB_KEY, VERSION) values (?, ?, ?, ?)]; ORA-08177: can't serialize access for this transaction ; nested exception is java.sql.SQLException: ORA-08177: can't serialize access for this transaction
Database: oracle 11g,
SO i want to change the isolation level to READ_COMMITTED.
any help will be appreciable. thnks
Upvotes: 0
Views: 3113
Reputation: 70
you need to set it up at the job-repository level
<batch:job-repository
id="jobRepository"
data-source="your-dataSource"
transaction-manager="your-transactionManager"
isolation-level-for-create="READ_COMMITTED" />
Upvotes: 0