org.springframework.orm.ibatis.support
Class BlobByteArrayTypeHandler

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.BlobByteArrayTypeHandler
All Implemented Interfaces:
com.ibatis.sqlmap.engine.type.TypeHandler

public class BlobByteArrayTypeHandler
extends AbstractLobTypeHandler

iBATIS TypeHandler implementation for byte arrays that get mapped 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
  BlobByteArrayTypeHandler()
          Constructor used by iBATIS: fetches config-time LobHandler from SqlMapClientFactoryBean.
protected BlobByteArrayTypeHandler(LobHandler lobHandler)
          Constructor used for testing: takes an explicit LobHandler.
 
Method Summary
protected  Object getResultInternal(ResultSet rs, int index, LobHandler lobHandler)
          Template method to extract a value from the given result set.
protected  void setParameterInternal(PreparedStatement ps, int index, Object value, String jdbcType, LobCreator lobCreator)
          Template method to set the given value on the given statement.
 Object valueOf(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

BlobByteArrayTypeHandler

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

See Also:
SqlMapClientFactoryBean.getConfigTimeLobHandler()

BlobByteArrayTypeHandler

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

Method Detail

setParameterInternal

protected void setParameterInternal(PreparedStatement ps,
                                    int index,
                                    Object value,
                                    String jdbcType,
                                    LobCreator lobCreator)
                             throws SQLException
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:
SQLException - if thrown by JDBC methods

getResultInternal

protected Object getResultInternal(ResultSet rs,
                                   int index,
                                   LobHandler lobHandler)
                            throws SQLException
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:
SQLException - if thrown by JDBC methods

valueOf

public Object valueOf(String s)