Boa Tarde!!!
Preciso criar uma lista com a descrição de 1 object alguém pode me ajudar ?
public List<Imovel> lista_selecina_imovel(int id_imovel) {
List<Imovel> listImovel;
listImovel = new ArrayList<>();
Connection con = Conexao.Conexao();
String sql;
ResultSet rs = null;
PreparedStatement pst = null;
try {
sql = "select * from imovel WHERE id_imovel = ?";
pst = con.prepareStatement(sql);
pst.setInt(1, id_imovel);
rs = pst.executeQuery();
while (rs.next()) {
listImovel.add(new Imovel(rs.getInt("id_imovel"),rs.getObject("descricao",getClass()),rs.getObject("descricao", getClass()),
rs.getFloat("valor"),rs.getString("rua"), rs.getString ("numero"), rs.getString("complemento"),
rs.getString("bairro"), rs.getString("cidade"), rs.getString("uf"),rs.getString("data_cadastro"),
rs.getString("referencia"), rs.getString("cep"), rs.getString("placa"), rs.getString("terreno"),
rs.getString("area"), rs.getInt("pasta"), rs.getString("descrição"), rs.getString("acabamento"),
rs.getString("observacao")));
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Erro ao iniciar lista" + ex);
} finally {
Conexao.closeConnection(con, pst, rs);
}
return listImovel;
}
