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 forPreparedStatementSetter
that applies given arrays of arguments and JDBC argument types.- Since:
- 3.2.3
- Author:
- Juergen Hoeller
Constructor Summary
Constructors Constructor Description ArgumentTypePreparedStatementSetter(Object[] args, int[] argTypes)
Create a new ArgTypePreparedStatementSetter for the given arguments.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanupParameters()
Close the resources allocated by parameters that the implementing object holds, for example in case of a DisposableSqlTypeValue (like a SqlLobValue).protected void
doSetValue(PreparedStatement ps, int parameterPosition, int argType, Object argValue)
Set the value for the prepared statement's specified parameter position using the passed in value and type.void
setValues(PreparedStatement ps)
Set parameter values on the given PreparedStatement.
Constructor Detail
ArgumentTypePreparedStatementSetter
public ArgumentTypePreparedStatementSetter(Object[] args, int[] argTypes)
Create a new ArgTypePreparedStatementSetter for the given arguments.- Parameters:
args
- the arguments to setargTypes
- the corresponding SQL types of the arguments
Method Detail
setValues
public void setValues(PreparedStatement ps) throws SQLException
Description copied from interface:PreparedStatementSetter
Set parameter values on the given PreparedStatement.- Specified by:
setValues
in interfacePreparedStatementSetter
- Parameters:
ps
- the PreparedStatement to invoke setter methods on- Throws:
SQLException
- if a SQLException is encountered (i.e. there is no need to catch SQLException)
doSetValue
protected void doSetValue(PreparedStatement ps, int parameterPosition, int argType, Object argValue) throws SQLException
Set the value for the prepared statement's specified parameter position using the passed in value and type. This method can be overridden by sub-classes 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:ParameterDisposer
Close the resources allocated by parameters that the implementing object holds, for example in case of a DisposableSqlTypeValue (like a SqlLobValue).- Specified by:
cleanupParameters
in interfaceParameterDisposer
- See Also:
DisposableSqlTypeValue.cleanup()
,SqlLobValue.cleanup()