Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Spring.Repaso02; import java.util.ArrayList; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.List; import org.springframework.jdbc.core.BeanPropertyRowMapper; import org.springframework.jdbc.core.JdbcTemplate; /** * * @author stdeceiver */ public class ProductoDAO implements ProductoDAOInterface { private JdbcTemplate jdbcTemplate; public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; } public ArrayList<Producto> consultaAll(GregorianCalendar fecha) { int dia = (7 + fecha.get(Calendar.DAY_OF_WEEK) - Calendar.SUNDAY) % 7; String selQuery = "select * from TProductos where Disponible = 0 or Disponible = ?"; List productos = jdbcTemplate.query(selQuery, new Object[] { dia }, new BeanPropertyRowMapper(Producto.class)); return (ArrayList) productos; } }