April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
Spring DAO
nUsando um template jdbc do spring
npublic void updateCustomer(Customer customer) {
n String sql = “update customer set ” +
n “firstName = ?, lastName = ?, ...”);
n Object[] params = new Object[] {
n customer.getFirstName(),
n customer.getLastName(),
n ...};
n int[] types = new int[] {
n Types.VARCHAR,
n Types.VARCHAR,
n ...};
n jdbcTemplate.update(sql, params, types);
n}
O jdbcTemplate pode ser injetado pelo container...