Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.orm.ibatis.support
Class AbstractLobTypeHandler

    java.lang.Object
      com.ibatis.sqlmap.engine.type.BaseTypeHandler
          org.springframework.orm.ibatis.support.AbstractLobTypeHandler

All Implemented Interfaces:
  com.ibatis.sqlmap.engine.type.TypeHandler

Direct Known Subclasses:
  BlobByteArrayTypeHandler, BlobSerializableTypeHandler, ClobStringTypeHandler

    public abstract class AbstractLobTypeHandler

extends com.ibatis.sqlmap.engine.type.BaseTypeHandler

Abstract base class for iBATIS TypeHandler implementations that map to LOBs. Retrieves the LobHandler to use from SqlMapClientFactoryBean at config time.

For writing LOBs, an active Spring transaction synchronization is required, to be able to register a synchronization that closes the LobCreator.

Offers template methods for setting parameters and getting result values, passing in the LobHandler or LobCreator to use.

Since:
  1.1.5
Author:
  Juergen Hoeller
See Also:
  `LobHandler`, `LobCreator`, `SqlMapClientFactoryBean.setLobHandler(org.springframework.jdbc.support.lob.LobHandler)`

Field Summary
`static int` | `LOB_CREATOR_SYNCHRONIZATION_ORDER` Order value for TransactionSynchronization objects that clean up LobCreators.

Constructor Summary
`` | `AbstractLobTypeHandler()` Constructor used by iBATIS: fetches config-time LobHandler from SqlMapClientFactoryBean.
`protected` | `AbstractLobTypeHandler(LobHandler lobHandler)` Constructor used for testing: takes an explicit LobHandler.

Method Summary
`java.lang.Object` | `getResult(java.sql.CallableStatement cs, int columnIndex)` This implementation always throws a SQLException: retrieving LOBs from a CallableStatement is not supported.
`java.lang.Object` | `getResult(java.sql.ResultSet rs, int columnIndex)` This implementation delegates to getResultInternal, passing in the LobHandler of this type.
`java.lang.Object` | `getResult(java.sql.ResultSet rs, java.lang.String columnName)` This implementation delegates to the getResult version that takes a column index.
`protected abstract java.lang.Object` | `getResultInternal(java.sql.ResultSet rs, int index, LobHandler lobHandler)` Template method to extract a value from the given result set.
`void` | `setParameter(java.sql.PreparedStatement ps, int i, java.lang.Object parameter, java.lang.String jdbcType)` This implementation delegates to setParameterInternal, passing in a transaction-synchronized LobCreator for the LobHandler of this type.
`protected abstract void` | `setParameterInternal(java.sql.PreparedStatement ps, int index, java.lang.Object value, java.lang.String jdbcType, LobCreator lobCreator)` Template method to set the given value on the given statement.

Methods inherited from class com.ibatis.sqlmap.engine.type.BaseTypeHandler
`equals`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.ibatis.sqlmap.engine.type.TypeHandler
`valueOf`

Field Detail

### LOB_CREATOR_SYNCHRONIZATION_ORDER

    public static final int LOB_CREATOR_SYNCHRONIZATION_ORDER

  Order value for TransactionSynchronization objects that clean up LobCreators. Return DataSourceUtils.#CONNECTION_SYNCHRONIZATION_ORDER - 100 to execute LobCreator cleanup before JDBC Connection cleanup, if any.

  See Also:
    `DataSourceUtils.CONNECTION_SYNCHRONIZATION_ORDER`, Constant Field Values

Constructor Detail

### AbstractLobTypeHandler

    public AbstractLobTypeHandler()

  Constructor used by iBATIS: fetches config-time LobHandler from SqlMapClientFactoryBean.

  See Also:
    `SqlMapClientFactoryBean.getConfigTimeLobHandler()`

### AbstractLobTypeHandler

    protected AbstractLobTypeHandler(LobHandler lobHandler)

  Constructor used for testing: takes an explicit LobHandler.

Method Detail

### setParameter

    public final void setParameter(java.sql.PreparedStatement ps,
                                   int i,
                                   java.lang.Object parameter,
                                   java.lang.String jdbcType)
                            throws java.sql.SQLException

  This implementation delegates to setParameterInternal, passing in a transaction-synchronized LobCreator for the LobHandler of this type.

  Throws:
    `java.sql.SQLException`
  See Also:
    `setParameterInternal(java.sql.PreparedStatement, int, java.lang.Object, java.lang.String, org.springframework.jdbc.support.lob.LobCreator)`

### getResult

    public final java.lang.Object getResult(java.sql.ResultSet rs,
                                            java.lang.String columnName)
                                     throws java.sql.SQLException

  This implementation delegates to the getResult version that takes a column index.

  Throws:
    `java.sql.SQLException`
  See Also:
    `getResult(java.sql.ResultSet, String)`, `ResultSet.findColumn(java.lang.String)`

### getResult

    public final java.lang.Object getResult(java.sql.ResultSet rs,
                                            int columnIndex)
                                     throws java.sql.SQLException

  This implementation delegates to getResultInternal, passing in the LobHandler of this type.

  Throws:
    `java.sql.SQLException`
  See Also:
    `getResultInternal(java.sql.ResultSet, int, org.springframework.jdbc.support.lob.LobHandler)`

### getResult

    public java.lang.Object getResult(java.sql.CallableStatement cs,
                                      int columnIndex)
                               throws java.sql.SQLException

  This implementation always throws a SQLException: retrieving LOBs from a CallableStatement is not supported.

  Throws:
    `java.sql.SQLException`

### setParameterInternal

    protected abstract void setParameterInternal(java.sql.PreparedStatement ps,
                                                 int index,
                                                 java.lang.Object value,
                                                 java.lang.String jdbcType,
                                                 LobCreator lobCreator)
                                          throws java.sql.SQLException,
                                                 java.io.IOException

  Template method to set the given value on the given statement.

  Parameters:
    `ps` - the PreparedStatement to set on
    `index` - the statement parameter index
    `value` - the parameter value to set
    `jdbcType` - the JDBC type of the parameter
    `lobCreator` - the LobCreator to use
  Throws:
    `java.sql.SQLException` - if thrown by JDBC methods
    `java.io.IOException` - if thrown by streaming methods

### getResultInternal

    protected abstract java.lang.Object getResultInternal(java.sql.ResultSet rs,
                                                          int index,
                                                          LobHandler lobHandler)
                                                   throws java.sql.SQLException,
                                                          java.io.IOException

  Template method to extract a value from the given result set.

  Parameters:
    `rs` - the ResultSet to extract from
    `index` - the index in the ResultSet
    `lobHandler` - the LobHandler to use
  Returns:
    the extracted value
  Throws:
    `java.sql.SQLException` - if thrown by JDBC methods
    `java.io.IOException` - if thrown by streaming methods

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD