类 AbstractSqlTypeValue

  • 所有已实现的接口:
    SqlTypeValue

    public abstract class AbstractSqlTypeValue
    extends Object
    implements SqlTypeValue
    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<String, Object> in = new HashMap<String, Object>();
     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);
     
    从以下版本开始:
    1.1
    作者:
    Juergen Hoeller
    另请参阅:
    PreparedStatement.setObject(int, Object, int), StoredProcedure