Exemplo n.º 1
0
 public static Dia read(Date data) {
   Dia dia = null;
   Connector.connect();
   ResultSet resultSet = Connector.query("SELECT * FROM dia WHERE data ='" + data + "';");
   try {
     if (resultSet.next()) {
       dia = new Dia();
       dia.setIdDia(resultSet.getLong("iddia"));
       dia.setData(resultSet.getDate("data"));
     }
   } catch (Exception e) {
     System.out.println(e.getMessage());
   }
   Connector.close();
   return dia;
 }
Exemplo n.º 2
0
 public static ArrayList<Dia> getAll() {
   ArrayList<Dia> lista = new ArrayList<Dia>();
   Dia dia = null;
   Connector.connect();
   ResultSet resultSet = Connector.query("SELECT * FROM dia;");
   try {
     while (resultSet.next()) {
       dia = new Dia();
       dia.setIdDia(resultSet.getLong("iddia"));
       dia.setData(resultSet.getDate("data"));
       lista.add(dia);
     }
   } catch (Exception e) {
     System.out.println(e.getMessage());
   }
   Connector.close();
   return lista;
 }