public Cidade get(long codigo) {
PreparedStatement ppst = new SQLManager().getPreparedStatement(GET_CODIGO);
Cidade cidade = null;
try {
ppst.setLong(1, codigo);
ResultSet rs = ppst.executeQuery();
if (rs.next()) {
cidade = new Cidade(rs.getLong(1), rs.getString(2), rs.getString(3), rs.getBoolean(4, null);
}
o problema está no if quando chamo o boolean rs.getBoolean, ai da erro eu não sei o que fazer, até agora só havia trabalhado com String e Inteiros
sou meio iniciante em Java, espero que possam me ajudar
Obrigado
boolean getBoolean(int columnIndex) throws SQLException;
/**
* Retrieves the value of the designated column in the current row
* of this <code>ResultSet</code> object as
* a <code>byte</code> in the Java programming language.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return the column value; if the value is SQL <code>NULL</code>, the
* value returned is <code>0</code>
* @exception SQLException if the columnIndex is not valid;
* if a database access error occurs or this method is
* called on a closed result set
*/
e este :
boolean getBoolean(String columnLabel) throws SQLException;
/**
* Retrieves the value of the designated column in the current row
* of this <code>ResultSet</code> object as
* a <code>byte</code> in the Java programming language.
*
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
* @return the column value; if the value is SQL <code>NULL</code>, the
* value returned is <code>0</code>
* @exception SQLException if the columnLabel is not valid;
* if a database access error occurs or this method is
* called on a closed result set
*/
Abri a ResultSet aqui e não achei nenhum getBoolean que recebe dois argumentos.