public
classAbstractSqlTypeValue
implements
SqlTypeValue
Overview
Inheritance
Members
Usage
Source
Books
Since1.1
VersionNot specified.
Author(s)Juergen Hoeller
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);
PreparedStatement.setObjectmethod. ThecreateTypeValuecallback 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);