Java Reference
In-Depth Information
public void saveTicker(Ticker ticker) {
update(SAVE_TICKER, new Object [] {ticker.getTicker(), ticker.getPrice()});
public List<String> getTickersPaged(int page, int pageSize) {
return queryForList(FIND_ALL,
new Object [] {(page * pageSize), pageSize},
public BigDecimal getTotalValueForCustomer(long id) {
BigDecimal result = (BigDecimal) queryForObject(TOTAL_VALUE,
new Object [] {id},
if(result == null) {
result = new BigDecimal("0");
return result;
public List<Transaction> getStocksForCustomer(long id) {
return query(STOCKS_BY_CUSTOMER, new Object [] {id}, new RowMapper() {
public Object mapRow(ResultSet rs, int arg1) throws SQLException {
Transaction transaction = new Transaction();
return transaction;
The hard part in TickerDaoJdbc isn't the processing but is in the SQL. The execution of the SQL and
the mapping of the results to the objects is nothing more than standard uses of Spring's JdbcTemplate.
To make these three pieces work (the customer reader, CustomerStatementReader , and
TickerDaoJdbc , you need to update your configuration. Listing 10-44 shows the configuration for these
three components.
Listing 10-44. Configuring the generateMonthlyStatement Step
<beans:bean id="customerReader"
Search WWH ::

Custom Search