Class SqlStatementParameterSetter


  • @Technical
    @Bean
    @Singleton
    public class SqlStatementParameterSetter
    extends Object
    A setter of parameters of a PreparedStatement instance according to the concrete type of the value with which the parameter has to be set.
    Author:
    mmoquillon
    • Constructor Detail

      • SqlStatementParameterSetter

        public SqlStatementParameterSetter()
    • Method Detail

      • setParameter

        public void setParameter​(PreparedStatement statement,
                                 int idx,
                                 Object value)
                          throws SQLException
        Sets the nth parameter of the specified SQL statement with the given value. The setting is really done by using the parameter setter that supports the concrete type of the value; that is to say by the setter that knows how to set a SQL parameter of a given type.
        Parameters:
        statement - a PreparedStatement instance representing the SQL request.
        idx - the index of the parameter in the SQL statement.
        value - the value with which will be set the parameter.
        Throws:
        SQLException - if an error occurs while setting the parameter.