title: transaction isolation level (READ UNCOMMITTED) of Spring Batch
body: <p>I want to set transaction isolation level to READ UNCOMMITTED, but is doesn't work.</p>
  
  <p>Here is my job source.</p>
  
  <p>TestJobConfiguration.java</p>
  
  <pre class="lang-java prettyprint-override"><code>@Slf4j
  @Configuration
  public class TestJobConfiguration {
      @Autowired
      private JobBuilderFactory jobBuilders;
  
      @Autowired
      private CustomJobExecutionListener customJobExecutionListener;
  
      @Autowired
      private JdbcTemplate jdbcTemplate;
  
      @Autowired
      private StepBuilderFactory stepBuilders;
  
      @Bean(name = "testJob")
      public Job job() {
          JobBuilder jobBuilder = jobBuilders.get("testJob").listener(customJobExecutionListener);
          Step step = stepBuilders.get("testStep").tasklet(count()).transactionAttribute(transactionAttr())
          .build();
  
          return jobBuilder.start(step).build();
      }
  
      public TransactionAttribute transactionAttr() {
          RuleBasedTransactionAttribute tr = new RuleBasedTransactionAttribute();
          tr.setIsolationLevel(TransactionDefinition.ISOLATION_READ_UNCOMMITTED);
          return tr;
      }
  
      public Tasklet count() {
          return new Tasklet() {
              @Override
              public RepeatStatus execute(StepContribution contribution, ChunkContext context) {
                  StringBuilder countSql = new StringBuilder();
                  countSql.append(" SELECT COUNT(id)");
                  countSql.append(" FROM user");
                  log.debug("test start");
                  int count = jdbcTemplate.queryForObject(countSql.toString(), Integer.class);
                  contribution.incrementWriteCount(count);
                  log.debug("test end");
                  log.debug("count : {}", count);
                  return RepeatStatus.FINISHED;
              }
          };
      }
  
  }
  </code></pre>
  
  <p>I executed below sql statement in Microsoft SQL Server Management Studio, and executed TestJob.</p>
  
  <pre class="lang-sql prettyprint-override"><code>begin tran
  delete  from user
  </code></pre>
  
  <p>I expected to complete job, but it stopped at sql execution point.
  My log is below.</p>
  
  <pre><code>...
  2017-08-29T12:21:23.555+09:00 DEBUG   --- [           main] c.p.l.b.rank.job.TestJobConfiguration    : test start
  </code></pre>
  
  <p>When I change my sql statement, <code>countSql.append(" SELECT COUNT(id)"); to countSql.append(" SELECT COUNT(id) WITH (READUNCOMMITTED)");</code> it works.</p>
  
  <pre><code>...
  2017-08-29T13:44:43.692+09:00 DEBUG   --- [           main] c.p.l.b.rank.job.TestJobConfiguration    : test start
  2017-08-29T13:44:43.726+09:00 DEBUG   --- [           main] c.p.l.b.rank.job.TestJobConfiguration    : test end
  2017-08-29T13:44:43.726+09:00 DEBUG   --- [           main] c.p.l.b.rank.job.TestJobConfiguration    : count : 15178
  2017-08-29T13:44:43.747+09:00  INFO   --- [           main] c.p.l.b.l.CustomJobExecutionListener     : 
  &lt;!-----------------------------------------------------------------
  Protocol for testJob 
    Started     : Tue Aug 29 13:44:43 KST 2017
    Finished    : Tue Aug 29 13:44:43 KST 2017
    Exit-Code   : COMPLETED
    Exit-Descr. : 
    Status      : COMPLETED
  Job-Parameter: 
    date=2017-08-29 13:44:43 +0900
  JOB process time  : 0sec
  -----------------------------------------------------------------&gt;
  </code></pre>
  
  <p>Why doesn't work isolation level of transaction attribute??</p>