RESOLVED - issue BATCH-262: Hibernate Job blocks on flush
http://jira.springframework.org/browse/BATCH-262 The hibernate job blocks with high isolatio nlevels because it is reading a cursor and then updating the same objects (the cursor is in a different transaction because it uses openSession()). The resolution is to change the isolation level - might be worth some more careful work later to encourage the right sort of best practice.
This commit is contained in:
@@ -75,17 +75,22 @@ public abstract class AbstractCustomerCreditIncreaseTests extends AbstractValida
|
||||
|
||||
final List matches = new ArrayList();
|
||||
|
||||
jdbcTemplate.query(ALL_CUSTOMERS, new RowMapper() {
|
||||
new TransactionTemplate(transactionManager).execute(new TransactionCallback() {
|
||||
public Object doInTransaction(TransactionStatus status) {
|
||||
jdbcTemplate.query(ALL_CUSTOMERS, new RowMapper() {
|
||||
|
||||
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
final BigDecimal creditBeforeUpdate = (BigDecimal) creditsBeforeUpdate.get(rowNum);
|
||||
final BigDecimal expectedCredit = creditBeforeUpdate.add(CREDIT_INCREASE);
|
||||
if (expectedCredit.equals(rs.getBigDecimal(CREDIT_COLUMN))) {
|
||||
matches.add(rs.getBigDecimal(ID_COLUMN));
|
||||
}
|
||||
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
final BigDecimal creditBeforeUpdate = (BigDecimal) creditsBeforeUpdate.get(rowNum);
|
||||
final BigDecimal expectedCredit = creditBeforeUpdate.add(CREDIT_INCREASE);
|
||||
if (expectedCredit.equals(rs.getBigDecimal(CREDIT_COLUMN))) {
|
||||
matches.add(rs.getBigDecimal(ID_COLUMN));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
assertEquals(getExpectedMatches(), matches.size());
|
||||
|
||||
Reference in New Issue
Block a user