Spring Data JDBC Extensions

org.springframework.data.jdbc.support.oracle
Class SqlStructArrayValue<T>

java.lang.Object
  extended by org.springframework.jdbc.core.support.AbstractSqlTypeValue
      extended by org.springframework.data.jdbc.support.oracle.SqlStructArrayValue<T>
All Implemented Interfaces:
SqlTypeValue

public class SqlStructArrayValue<T>
extends AbstractSqlTypeValue

Implementation of the SqlTypeValue interface, for convenient creation of provided type values as an ARRAY of STRUCTS.

A usage example from a StoredProcedure:

proc.declareParameter(new SqlParameter("myarray", Types.ARRAY, "ACTOR_TYPE_ARRAY"));
 ...

 Map in = new HashMap();
 in.put("myarray", new SqlStructArrayValue<Number>(objectArray, actorMapper);
 Map out = proc.execute(in);
 

Since:
1.0
Author:
Thomas Risberg
See Also:
SqlTypeValue, AbstractSqlTypeValue, SimpleJdbcCall, StoredProcedure

Field Summary
 
Fields inherited from interface org.springframework.jdbc.core.SqlTypeValue
TYPE_UNKNOWN
 
Constructor Summary
SqlStructArrayValue(T[] values, StructMapper<T> mapper, String structTypeName)
          Constructor that takes a parameter with the array of values passed in to the statement, a parameter with the StructMapper to be used plus the type name of the STRUCT that the array will contain.
SqlStructArrayValue(T[] values, StructMapper<T> mapper, String structTypeName, String arrayTypeName)
          Constructor that takes a parameter with the array of values passed in to the statement, a parameter with the StructMapper to be used plus the type name of the STRUCT that the array will contain.
 
Method Summary
protected  Object createTypeValue(Connection conn, int sqlType, String typeName)
          The implementation for this specific type.
 
Methods inherited from class org.springframework.jdbc.core.support.AbstractSqlTypeValue
setTypeValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlStructArrayValue

public SqlStructArrayValue(T[] values,
                           StructMapper<T> mapper,
                           String structTypeName)
Constructor that takes a parameter with the array of values passed in to the statement, a parameter with the StructMapper to be used plus the type name of the STRUCT that the array will contain.

Parameters:
values - the array containing the values
mapper - the mapper to create the STRUCT values
structTypeName - the type name of the STRUCT.

SqlStructArrayValue

public SqlStructArrayValue(T[] values,
                           StructMapper<T> mapper,
                           String structTypeName,
                           String arrayTypeName)
Constructor that takes a parameter with the array of values passed in to the statement, a parameter with the StructMapper to be used plus the type name of the STRUCT that the array will contain.

Parameters:
values - the array containing the values
mapper - the mapper to create the STRUCT values
structTypeName - the type name of the STRUCT.
arrayTypeName - the type name of the ARRAY when this class is used in a context where the name of the array type is not known.
Method Detail

createTypeValue

protected Object createTypeValue(Connection conn,
                                 int sqlType,
                                 String typeName)
                          throws SQLException
The implementation for this specific type. This method is called internally by the Spring Framework during the out parameter processing and it's not accessed by application code directly.

Specified by:
createTypeValue in class AbstractSqlTypeValue
Throws:
SQLException
See Also:
AbstractSqlTypeValue

Spring Data JDBC Extensions