Spring Framework

org.springframework.orm.ibatis.support
Class BlobSerializableTypeHandler

java.lang.Object
  extended by com.ibatis.sqlmap.engine.type.BaseTypeHandler
      extended by org.springframework.orm.ibatis.support.AbstractLobTypeHandler
          extended by org.springframework.orm.ibatis.support.BlobSerializableTypeHandler
All Implemented Interfaces:
com.ibatis.sqlmap.engine.type.TypeHandler

public class BlobSerializableTypeHandler
extends AbstractLobTypeHandler

iBATIS TypeHandler implementation for arbitrary objects that get serialized to BLOBs. Retrieves the LobHandler to use from SqlMapClientFactoryBean at config time.

Can also be defined in generic iBATIS mappings, as DefaultLobCreator will work with most JDBC-compliant database drivers. In this case, the field type does not have to be BLOB: For databases like MySQL and MS SQL Server, any large enough binary type will work.

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

Field Summary
 
Fields inherited from class org.springframework.orm.ibatis.support.AbstractLobTypeHandler
LOB_CREATOR_SYNCHRONIZATION_ORDER
 
Constructor Summary
  BlobSerializableTypeHandler()
          Constructor used by iBATIS: fetches config-time LobHandler from SqlMapClientFactoryBean.
protected BlobSerializableTypeHandler(LobHandler lobHandler)
          Constructor used for testing: takes an explicit LobHandler.
 
Method Summary
protected  java.lang.Object getResultInternal(java.sql.ResultSet rs, int index, LobHandler lobHandler)
          Template method to extract a value from the given result set.
protected  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.
 java.lang.Object valueOf(java.lang.String s)
           
 
Methods inherited from class org.springframework.orm.ibatis.support.AbstractLobTypeHandler
getResult, getResult, getResult, setParameter
 
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
 

Constructor Detail

BlobSerializableTypeHandler

public BlobSerializableTypeHandler()
Constructor used by iBATIS: fetches config-time LobHandler from SqlMapClientFactoryBean.

See Also:
SqlMapClientFactoryBean.getConfigTimeLobHandler()

BlobSerializableTypeHandler

protected BlobSerializableTypeHandler(LobHandler lobHandler)
Constructor used for testing: takes an explicit LobHandler.

Method Detail

setParameterInternal

protected 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
Description copied from class: AbstractLobTypeHandler
Template method to set the given value on the given statement.

Specified by:
setParameterInternal in class AbstractLobTypeHandler
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 java.lang.Object getResultInternal(java.sql.ResultSet rs,
                                             int index,
                                             LobHandler lobHandler)
                                      throws java.sql.SQLException,
                                             java.io.IOException
Description copied from class: AbstractLobTypeHandler
Template method to extract a value from the given result set.

Specified by:
getResultInternal in class AbstractLobTypeHandler
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

valueOf

public java.lang.Object valueOf(java.lang.String s)

Spring Framework