@Autowired
public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
private final static String LEND_LIST_SQL = "SELECT * FROM lend_list ";
public ArrayList<LendBook> lendList(){
final ArrayList<LendBook> list = new ArrayList<LendBook>();
jdbcTemplate.query(LEND_LIST_SQL, new RowCallbackHandler() {
@Override
public void processRow(ResultSet resultSet) throws SQLException {
resultSet.beforeFirst();
while (resultSet.next()){
LendBook lendBook = new LendBook();
lendBook.setBackDate(resultSet.getDate("back_date"));
lendBook.setBookId(resultSet.getLong("book_id"));
lendBook.setLendDate(resultSet.getDate("lend_date"));
lendBook.setReaderId(resultSet.getInt("reader_id"));
lendBook.setSernum(resultSet.getLong("sernum"));
list.add(lendBook);
}
}
});
实在是解决不了了,求助