Como fazer a consulta de um boolean no banco?
public class JDBCConsultar {
public Box consultar(Box box) {
Connection consultar = PostgreSQL.getConnection();
try{
String sql = "Select * from box where id_box = ?";
PreparedStatement stmt = consultar.prepareStatement(sql);
stmt.setInt(1, box.getId());
ResultSet rs = stmt.executeQuery();
if(!rs.next())
return null;
Box box1 = new Box();
box1.setId(rs.getInt("id_box"));
box1.setNumero(rs.getInt("numero"));
box1.isVago(rs.getBoolean("vago"));// como faço a consulta de um tipo boolean.
}catch(Exception e){
JOptionPane.showMessageDialog(null, "erro ao Consultar Box" + e.getMessage());
}
finally {
try {
consultar.close();
} catch (SQLException ex) {
Logger.getLogger(JDBCCriarTabela.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}