Announcement Announcement Module
No announcement yet.
Transactions and job execution Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Transactions and job execution

    I have a chunk of code to start a job as well as record some external information on who started the job like so:
    	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);
    and beans defined as:
        <bean id="jobOperator" class="">
            <property name="jobExplorer" ref="jobExplorer"/>
            <property name="jobLauncher" ref="jobLauncher"/>
            <property name="jobRegistry" ref="jobRegistry"/>
            <property name="jobRepository" ref="jobRepository"/>
        <bean id="jobRepository" class="">
            <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"/> -->
    With the Transaction defined as REQUIRED, the job hangs. This looks to be something along the lines of what
    was reported in

    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?