Package org.springframework.jdbc.core
Class ArgumentTypePreparedStatementSetter
java.lang.Object
org.springframework.jdbc.core.ArgumentTypePreparedStatementSetter
- All Implemented Interfaces:
ParameterDisposer,PreparedStatementSetter
public class ArgumentTypePreparedStatementSetter
extends Object
implements PreparedStatementSetter, ParameterDisposer
Simple adapter for
PreparedStatementSetter that applies the given
arrays of arguments and JDBC argument types.- Since:
- 3.2.3
- Author:
- Juergen Hoeller
-
Constructor Summary
ConstructorsConstructorDescriptionArgumentTypePreparedStatementSetter(Object[] args, int[] argTypes) Create a newArgumentTypePreparedStatementSetterfor the given arguments and types. -
Method Summary
Modifier and TypeMethodDescriptionvoidClose the resources allocated by parameters that the implementing object holds, for example in case of a DisposableSqlTypeValue (like an SqlLobValue).protected voiddoSetValue(PreparedStatement ps, int parameterPosition, int argType, Object argValue) Set the value for the prepared statement's specified parameter position using the supplied value and type.voidSet parameter values on the given PreparedStatement.
-
Constructor Details
-
ArgumentTypePreparedStatementSetter
Create a newArgumentTypePreparedStatementSetterfor the given arguments and types.- Parameters:
args- the arguments to setargTypes- the corresponding SQL types of the arguments
-
-
Method Details
-
setValues
Description copied from interface:PreparedStatementSetterSet parameter values on the given PreparedStatement.- Specified by:
setValuesin interfacePreparedStatementSetter- Parameters:
ps- the PreparedStatement to invoke setter methods on- Throws:
SQLException- if an SQLException is encountered (i.e. there is no need to catch SQLException)
-
doSetValue
protected void doSetValue(PreparedStatement ps, int parameterPosition, int argType, @Nullable Object argValue) throws SQLException Set the value for the prepared statement's specified parameter position using the supplied value and type.This method can be overridden by subclasses if needed.
- Parameters:
ps- the PreparedStatementparameterPosition- index of the parameter positionargType- the argument typeargValue- the argument value- Throws:
SQLException- if thrown by PreparedStatement methods
-
cleanupParameters
public void cleanupParameters()Description copied from interface:ParameterDisposerClose the resources allocated by parameters that the implementing object holds, for example in case of a DisposableSqlTypeValue (like an SqlLobValue).- Specified by:
cleanupParametersin interfaceParameterDisposer- See Also:
-