|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibatis.sqlmap.engine.type.BaseTypeHandler
org.springframework.orm.ibatis.support.AbstractLobTypeHandler
public abstract class AbstractLobTypeHandler
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.
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 | |
---|---|
Object |
getResult(CallableStatement cs,
int columnIndex)
This implementation always throws a SQLException: retrieving LOBs from a CallableStatement is not supported. |
Object |
getResult(ResultSet rs,
int columnIndex)
This implementation delegates to getResultInternal, passing in the LobHandler of this type. |
Object |
getResult(ResultSet rs,
String columnName)
This implementation delegates to the getResult version that takes a column index. |
protected abstract Object |
getResultInternal(ResultSet rs,
int index,
LobHandler lobHandler)
Template method to extract a value from the given result set. |
void |
setParameter(PreparedStatement ps,
int i,
Object parameter,
String jdbcType)
This implementation delegates to setParameterInternal, passing in a transaction-synchronized LobCreator for the LobHandler of this type. |
protected abstract void |
setParameterInternal(PreparedStatement ps,
int index,
Object value,
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 |
---|
public static final int LOB_CREATOR_SYNCHRONIZATION_ORDER
DataSourceUtils.CONNECTION_SYNCHRONIZATION_ORDER
,
Constant Field ValuesConstructor Detail |
---|
public AbstractLobTypeHandler()
SqlMapClientFactoryBean.getConfigTimeLobHandler()
protected AbstractLobTypeHandler(LobHandler lobHandler)
Method Detail |
---|
public final void setParameter(PreparedStatement ps, int i, Object parameter, String jdbcType) throws SQLException
SQLException
setParameterInternal(java.sql.PreparedStatement, int, java.lang.Object, java.lang.String, org.springframework.jdbc.support.lob.LobCreator)
public final Object getResult(ResultSet rs, String columnName) throws SQLException
SQLException
getResult(java.sql.ResultSet, String)
,
ResultSet.findColumn(java.lang.String)
public final Object getResult(ResultSet rs, int columnIndex) throws SQLException
SQLException
getResultInternal(java.sql.ResultSet, int, org.springframework.jdbc.support.lob.LobHandler)
public Object getResult(CallableStatement cs, int columnIndex) throws SQLException
SQLException
protected abstract void setParameterInternal(PreparedStatement ps, int index, Object value, String jdbcType, LobCreator lobCreator) throws SQLException, IOException
ps
- the PreparedStatement to set onindex
- the statement parameter indexvalue
- the parameter value to setjdbcType
- the JDBC type of the parameterlobCreator
- the LobCreator to use
SQLException
- if thrown by JDBC methods
IOException
- if thrown by streaming methodsprotected abstract Object getResultInternal(ResultSet rs, int index, LobHandler lobHandler) throws SQLException, IOException
rs
- the ResultSet to extract fromindex
- the index in the ResultSetlobHandler
- the LobHandler to use
SQLException
- if thrown by JDBC methods
IOException
- if thrown by streaming methods
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |