| java.lang.Object org.springframework.jdbc.core.support.AbstractSqlTypeValue
AbstractSqlTypeValue | abstract public class AbstractSqlTypeValue implements SqlTypeValue(Code) | | Abstract implementation of the SqlTypeValue interface, for convenient
creation of type values that are supposed to be passed into the
PreparedStatement.setObject method. The createTypeValue
callback method has access to the underlying Connection, if that should
be needed to create any database-specific objects.
A usage example from a StoredProcedure (compare this to the plain
SqlTypeValue version in the superclass javadoc):
proc.declareParameter(new SqlParameter("myarray", Types.ARRAY, "NUMBERS"));
...
Map in = new HashMap();
in.put("myarray", new AbstractSqlTypeValue() {
public Object createTypeValue(Connection con, int sqlType, String typeName) throws SQLException {
oracle.sql.ArrayDescriptor desc = new oracle.sql.ArrayDescriptor(typeName, con);
return new oracle.sql.ARRAY(desc, con, seats);
}
});
Map out = execute(in);
author: Juergen Hoeller since: 1.1 See Also: java.sql.PreparedStatement.setObject(intObjectint) See Also: org.springframework.jdbc.object.StoredProcedure |
createTypeValue | abstract protected Object createTypeValue(Connection con, int sqlType, String typeName) throws SQLException(Code) | | Create the type value to be passed into PreparedStatement.setObject .
Parameters: con - the JDBC Connection, if needed to create any database-specific objects Parameters: sqlType - SQL type of the parameter we are setting Parameters: typeName - the type name of the parameter the type value throws: SQLException - if a SQLException is encountered settingparameter values (that is, there's no need to catch SQLException) See Also: java.sql.PreparedStatement.setObject(intObjectint) |
|
|