Je OAC avec méthode de sauvegardePreparedStatement setBigDecimal de 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;
}
}
}
et findbug dit:
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
Comment puis-je setBigDecimal?
stmt.setBigDecimal(1, new BigDecimal(????));
Etes-vous sûr que l'avertissement concerne cette ligne? Il n'y a pas de casting. Vous obtenez un argument BigDecimal et le fournissez à une méthode prenant un argument BigDecimal. –