Package org.springframework.jdbc.core

# Interface SqlTypeValue

All Known Subinterfaces:
  `DisposableSqlTypeValue`

All Known Implementing Classes:
  `AbstractSqlTypeValue`, `SqlBinaryValue`, `SqlCharacterValue`, `SqlLobValue`

public interface SqlTypeValue
Interface to be implemented for setting values for more complex database-specific types not supported by the standard `setObject` method. This is effectively an extended variant of `SqlValue`.

Implementations perform the actual work of setting the actual values. They must implement the callback method `setTypeValue` which can throw SQLExceptions that will be caught and translated by the calling code. This callback method has access to the underlying Connection via the given PreparedStatement object, if that should be needed to create any database-specific objects.

Since:
  1.1
Author:
  Thomas Risberg, Juergen Hoeller
See Also:
  - `Types`
  - `PreparedStatement.setObject(int, java.lang.Object, int)`
  - `JdbcOperations.update(String, Object[], int[])`
  - `SqlValue`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`TYPE_UNKNOWN`
Constant that indicates an unknown (or unspecified) SQL type.

## Method Summary

Modifier and Type
Method
Description
`void`
`setTypeValue(PreparedStatement ps, int paramIndex, int sqlType, String typeName)`
Set the type value on the given PreparedStatement.

## Field Details

### TYPE_UNKNOWN

static final int TYPE_UNKNOWN
Constant that indicates an unknown (or unspecified) SQL type. Passed into `setTypeValue` if the original operation method does not specify an SQL type.

See Also:
  - `Types`
  - `JdbcOperations.update(String, Object[])`
  - Constant Field Values

## Method Details

### setTypeValue

void setTypeValue(PreparedStatement ps, int paramIndex, int sqlType, @Nullable String typeName) throws SQLException
Set the type value on the given PreparedStatement.

Parameters:
  `ps` - the PreparedStatement to work on
  `paramIndex` - the index of the parameter for which we need to set the value
  `sqlType` - the SQL type of the parameter we are setting
  `typeName` - the type name of the parameter (optional)
Throws:
  `SQLException` - if an SQLException is encountered while setting parameter values
See Also:
  - `Types`
  - `PreparedStatement.setObject(int, java.lang.Object, int)`