October 2017
Intermediate to advanced
396 pages
10h 2m
English
In the following example, a class, AccountRowMapper, implements the RowMapper interface of the Spring Jdbc module:
package com.packt.patterninspring.chapter7.bankapp.rowmapper;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.RowMapper;
import com.packt.patterninspring.chapter7.bankapp.model.Account;
public class AccountRowMapper implements RowMapper<Account>{
@Override
public Account mapRow(ResultSet rs, int id) throws SQLException {
Account account = new Account();
account.setId(new Long(rs.getInt("id")));
account.setName(rs.getString("name"));
account.setBalance(new Long(rs.getInt("balance")));
return account;
}
}
In the preceding code, a class, AccountRowMapper ...
Read now
Unlock full access