1
我DAO與保存方法的PreparedStatement setBigDecimal從PARAMS
public void save(BigDecimal cashBackAmount){
try (Connection connection = dataSource.getConnection();
PreparedStatement stmt = connection.prepareStatement(query)) {
stmt.setBigDecimal(1, cashBackAmount);
stmt.executeUpdate();
} catch (SQLException e) {
log.error(e.getMessage());
throw e;
}
}
}
和findbug說:
FindBugs: Unchecked/unconfirmed cast This cast is unchecked, and not all instances of the type casted from can be cast to the type it is being cast to. Check that your program logic ensures that this cast will not fa
我怎麼能setBigDecimal?
stmt.setBigDecimal(1, new BigDecimal(????));
您確定警告是針對該行嗎?沒有任何事情會發生。你得到一個BigDecimal參數並將它提供給一個採用BigDecimal參數的方法。 –