RESOLVED - BATCH-650: Use FORWARD_ONLY as scroll mode in HibernateCursorItemReader
added item buffer and made the cursor forward-only (+ had to fix samples using stateful items with rollback)
This commit is contained in:
@@ -52,8 +52,12 @@ public class CustomerCredit {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void increaseCreditBy(BigDecimal sum) {
|
||||
this.credit = this.credit.add(sum);
|
||||
public CustomerCredit increaseCreditBy(BigDecimal sum) {
|
||||
CustomerCredit newCredit = new CustomerCredit();
|
||||
newCredit.credit = this.credit.add(sum);
|
||||
newCredit.name = this.name;
|
||||
newCredit.id = this.id;
|
||||
return newCredit;
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
|
||||
@@ -45,8 +45,7 @@ public class BatchSqlCustomerCreditIncreaseWriter implements ItemWriter, Initial
|
||||
* @see org.springframework.batch.item.processor.DelegatingItemWriter#doProcess(java.lang.Object)
|
||||
*/
|
||||
public void write(Object data) throws Exception {
|
||||
CustomerCredit customerCredit = (CustomerCredit) data;
|
||||
customerCredit.increaseCreditBy(FIXED_AMOUNT);
|
||||
CustomerCredit customerCredit = ((CustomerCredit) data).increaseCreditBy(FIXED_AMOUNT);
|
||||
delegate.write(customerCredit);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,7 @@ public class CustomerCreditIncreaseWriter extends AbstractItemWriter {
|
||||
* @see org.springframework.batch.item.processor.DelegatingItemWriter#doProcess(java.lang.Object)
|
||||
*/
|
||||
public void write(Object data) throws Exception {
|
||||
CustomerCredit customerCredit = (CustomerCredit) data;
|
||||
customerCredit.increaseCreditBy(FIXED_AMOUNT);
|
||||
CustomerCredit customerCredit = ((CustomerCredit) data).increaseCreditBy(FIXED_AMOUNT);
|
||||
customerCreditDao.writeCredit(customerCredit);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user