OPEN - issue BATCH-1383: onSkipInProcess is not called
http://jira.springframework.org/browse/BATCH-1383 Tidied up the skip sample. Could not reproduce issue.
This commit is contained in:
@@ -31,6 +31,8 @@ public class Trade implements Serializable {
|
||||
private long quantity = 0;
|
||||
private BigDecimal price = new BigDecimal(0);
|
||||
private String customer = "";
|
||||
private Long id;
|
||||
private long version = 0;
|
||||
|
||||
public Trade() {
|
||||
}
|
||||
@@ -42,7 +44,30 @@ public class Trade implements Serializable {
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
public void setCustomer(String customer) {
|
||||
/**
|
||||
* @param id
|
||||
*/
|
||||
public Trade(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public long getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(long version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public void setCustomer(String customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.batch.sample.domain.trade.internal;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.batch.sample.domain.trade.Trade;
|
||||
@@ -23,8 +25,6 @@ import org.springframework.batch.sample.domain.trade.TradeDao;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
|
||||
/**
|
||||
* Writes a Trade object to a database
|
||||
@@ -36,7 +36,7 @@ public class JdbcTradeDao implements TradeDao {
|
||||
/**
|
||||
* template for inserting a row
|
||||
*/
|
||||
private static final String INSERT_TRADE_RECORD = "INSERT INTO trade (id, isin, quantity, price, customer) VALUES (?, ?, ? ,?, ?)";
|
||||
private static final String INSERT_TRADE_RECORD = "INSERT INTO trade (id, version, isin, quantity, price, customer) VALUES (?, 0, ?, ? ,?, ?)";
|
||||
|
||||
/**
|
||||
* handles the processing of sql query
|
||||
@@ -44,7 +44,7 @@ public class JdbcTradeDao implements TradeDao {
|
||||
private SimpleJdbcTemplate simpleJdbcTemplate;
|
||||
|
||||
/**
|
||||
* database is not expected to be setup for autoincrementation
|
||||
* database is not expected to be setup for autoincrement
|
||||
*/
|
||||
private DataFieldMaxValueIncrementer incrementer;
|
||||
|
||||
|
||||
@@ -28,14 +28,17 @@ public class TradeRowMapper implements RowMapper {
|
||||
public static final int QUANTITY_COLUMN = 2;
|
||||
public static final int PRICE_COLUMN = 3;
|
||||
public static final int CUSTOMER_COLUMN = 4;
|
||||
public static final int ID_COLUMN = 5;
|
||||
public static final int VERSION_COLUMN = 6;
|
||||
|
||||
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
Trade trade = new Trade();
|
||||
Trade trade = new Trade(rs.getLong(ID_COLUMN));
|
||||
|
||||
trade.setIsin(rs.getString(ISIN_COLUMN));
|
||||
trade.setQuantity(rs.getLong(QUANTITY_COLUMN));
|
||||
trade.setPrice(rs.getBigDecimal(PRICE_COLUMN));
|
||||
trade.setCustomer(rs.getString(CUSTOMER_COLUMN));
|
||||
trade.setVersion(rs.getLong(VERSION_COLUMN));
|
||||
|
||||
return trade;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class TradeWriter extends ItemStreamSupport implements ItemWriter<Trade>
|
||||
|
||||
private static Log log = LogFactory.getLog(TradeWriter.class);
|
||||
|
||||
private static final String TOTAL_AMOUNT_KEY = "TOTAL_AMOUNT";
|
||||
public static final String TOTAL_AMOUNT_KEY = "TOTAL_AMOUNT";
|
||||
|
||||
private TradeDao dao;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user