I have a chunk of code to start a job as well as record some external information on who started the job like so:
and beans defined as:Code:@Transactional(propagation=Propagation.REQUIRED) public JobBean startJob(String username, String jobName, String parameters) { try { long jobExecutionId = jobOperator.start(jobName, parameters); this.recordJobExecutionInfo(jobExecutionId, username, null); return new JobBean(jobExplorer.getJobExecution(jobExecutionId)); } catch (Exception e) { throw new JobServiceException(e); } }
With the Transaction defined as REQUIRED, the job hangs. This looks to be something along the lines of whatCode:<bean id="jobOperator" class="org.springframework.batch.core.launch.support.SimpleJobOperator"> <property name="jobExplorer" ref="jobExplorer"/> <property name="jobLauncher" ref="jobLauncher"/> <property name="jobRegistry" ref="jobRegistry"/> <property name="jobRepository" ref="jobRepository"/> </bean> <bean id="jobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="transactionManager" ref="transactionManager"/> <property name="lobHandler" ref="lobHandler"/> <property name="isolationLevelForCreate" value="ISOLATION_DEFAULT"/> <!-- <property name="validateTransactionState" value="false"/> --> </bean>
was reported in https://jira.springsource.org/browse/BATCH-1668
If I remove the Transactional definition the job runs fine.
Is there any way to get the job to run and still have this Transaction?


Reply With Quote
