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参数的方法。 –