@Override public int insert(Object o) throws Exception { if (o instanceof LayoutActivo) { LayoutActivo item = (LayoutActivo) o; Connection conn = PoolConnection.getPoolConnection().getConnection(); PreparedStatement ps = conn.prepareStatement("insert into layoutactivo values (?,?)"); ps.setInt(1, item.getCocherasEstandar()); ps.setInt(2, item.getCocherasEspeciales()); ps.execute(); PoolConnection.getPoolConnection().releaseConnection(conn); return 0; } else { throw new Exception("Debe ser LayoutActivo: " + o); } }
@Override public void delete(Object o) throws Exception { if (o instanceof LayoutActivo) { LayoutActivo itemDelete = (LayoutActivo) o; Connection conn = PoolConnection.getPoolConnection().getConnection(); PreparedStatement ps = conn.prepareStatement( "delete from layoutactivo where cocherasEstandar = ? and cocherasEspeciales = ?"); ps.setInt(1, itemDelete.getCocherasEstandar()); ps.setInt(2, itemDelete.getCocherasEspeciales()); ps.execute(); PoolConnection.getPoolConnection().releaseConnection(conn); } else { throw new Exception("Debe ser LayoutActivo " + o); } }