Top Description Fields Constructors Methods
org.springframework.jdbc.support

public Class SqlArrayValue

extends Object
implements SqlValue
Class Inheritance
All Implemented Interfaces
org.springframework.jdbc.support.SqlValue
Imports
java.sql.Array, .PreparedStatement, .SQLException, org.springframework.dao.DataAccessResourceFailureException, org.springframework.lang.Nullable, org.springframework.util.Assert

Common SqlValue implementation for JDBC Array creation based on the JDBC 4 java.sql.Connection#createArrayOf method.

Also serves as a template for custom SqlValue implementations with cleanup demand.

Authors
Juergen Hoeller, Philippe Marschall
Since
6.1

Field Summary

Modifier and TypeField and Description
private Array
private final Object[]
private final String

Constructor Summary

AccessConstructor and Description
public
SqlArrayValue(String
the SQL name of the type the elements of the array map to
typeName
,
Object...
the elements to populate the Array object with
elements
)

Create a new SqlArrayValue for the given type name and elements.

Method Summary

Modifier and TypeMethod and Description
public void
cleanup()

Implements org.springframework.jdbc.support.SqlValue.cleanup.

Clean up resources held by this value object.
public void
setValue(PreparedStatement
the PreparedStatement to work on
ps
,
int
the index of the parameter for which we need to set the value
paramIndex
)

Implements org.springframework.jdbc.support.SqlValue.setValue.

Set the value on the given PreparedStatement.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

arrayback to summary
private Array array
Annotations
@Nullable
elementsback to summary
private final Object[] elements
typeNameback to summary
private final String typeName

Constructor Detail

SqlArrayValueback to summary
public SqlArrayValue(String typeName, Object... elements)

Create a new SqlArrayValue for the given type name and elements.

Parameters
typeName:String

the SQL name of the type the elements of the array map to

elements:Object[]

the elements to populate the Array object with

See Also
java.sql.Connection#createArrayOf

Method Detail

cleanupback to summary
public void cleanup()

Implements org.springframework.jdbc.support.SqlValue.cleanup.

Doc from org.springframework.jdbc.support.SqlValue.cleanup.

Clean up resources held by this value object.

Annotations
@Override
setValueback to summary
public void setValue(PreparedStatement ps, int paramIndex) throws SQLException

Implements org.springframework.jdbc.support.SqlValue.setValue.

Doc from org.springframework.jdbc.support.SqlValue.setValue.

Set the value on the given PreparedStatement.

Parameters
ps:PreparedStatement

the PreparedStatement to work on

paramIndex:int

the index of the parameter for which we need to set the value

Annotations
@Override
Exceptions
SQLException:
if an SQLException is encountered while setting parameter values