Package org.springframework.jdbc.support

# Class SqlArrayValue

java.lang.Object
org.springframework.jdbc.support.SqlArrayValue

All Implemented Interfaces:
  `SqlValue`

public class SqlArrayValue extends Object implements SqlValue
Common `SqlValue` implementation for JDBC `Array` creation based on the JDBC 4 `Connection.createArrayOf(java.lang.String, java.lang.Object[])` method.

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

Since:
  6.1
Author:
  Juergen Hoeller, Philippe Marschall

## Constructor Summary

Constructors
Constructor
Description
`SqlArrayValue(String typeName, Object... elements)`
Create a new `SqlArrayValue` for the given type name and elements.

## Method Summary

Modifier and Type
Method
Description
`void`
`cleanup()`
Clean up resources held by this value object.
`void`
`setValue(PreparedStatement ps, int paramIndex)`
Set the value on the given PreparedStatement.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SqlArrayValue

public SqlArrayValue(String typeName, Object... elements)
Create a new `SqlArrayValue` for the given type name and elements.

Parameters:
  `typeName` - the SQL name of the type the elements of the array map to
  `elements` - the elements to populate the `Array` object with
See Also:
  - `Connection.createArrayOf(java.lang.String, java.lang.Object[])`

## Method Details

### setValue

public void setValue(PreparedStatement ps, int paramIndex) throws SQLException
Description copied from interface: `SqlValue`
Set the value on the given PreparedStatement.

Specified by:
  `setValue` in interface `SqlValue`
Parameters:
  `ps` - the PreparedStatement to work on
  `paramIndex` - the index of the parameter for which we need to set the value
Throws:
  `SQLException` - if an SQLException is encountered while setting parameter values

### cleanup

public void cleanup()
Description copied from interface: `SqlValue`
Clean up resources held by this value object.

Specified by:
  `cleanup` in interface `SqlValue`