public abstract class AbstractLobTypeHandler
extends com.ibatis.sqlmap.engine.type.BaseTypeHandler
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,
org.springframework.orm.ibatis.SqlMapClientFactoryBean#setLobHandler| Modifier and Type | Field and Description |
|---|---|
static int |
LOB_CREATOR_SYNCHRONIZATION_ORDER
Order value for TransactionSynchronization objects that clean up LobCreators.
|
| Modifier | Constructor and Description |
|---|---|
|
AbstractLobTypeHandler()
Constructor used by iBATIS: fetches config-time LobHandler from
SqlMapClientFactoryBean.
|
protected |
AbstractLobTypeHandler(org.springframework.jdbc.support.lob.LobHandler lobHandler)
Constructor used for testing: takes an explicit LobHandler.
|
| Modifier and Type | Method and Description |
|---|---|
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,
org.springframework.jdbc.support.lob.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,
org.springframework.jdbc.support.lob.LobCreator lobCreator)
Template method to set the given value on the given statement.
|
public static final int LOB_CREATOR_SYNCHRONIZATION_ORDER
DataSourceUtils.CONNECTION_SYNCHRONIZATION_ORDER,
Constant Field Valuespublic AbstractLobTypeHandler()
org.springframework.orm.ibatis.SqlMapClientFactoryBean#getConfigTimeLobHandlerprotected AbstractLobTypeHandler(org.springframework.jdbc.support.lob.LobHandler lobHandler)
public final void setParameter(PreparedStatement ps, int i, Object parameter, String jdbcType) throws SQLException
ps - - the prepared statementi - - the parameter indexparameter - - the parameter valuejdbcType - - the JDBC type of the parameterSQLException - if setting the parameter failssetParameterInternal(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
rs - - the result setcolumnName - - the column name to getSQLException - if getting the value failsgetResult(java.sql.ResultSet, String),
ResultSet.findColumn(java.lang.String)public final Object getResult(ResultSet rs, int columnIndex) throws SQLException
rs - - the result setcolumnIndex - - the column to get (by index)SQLException - if getting the value failsgetResultInternal(java.sql.ResultSet, int, org.springframework.jdbc.support.lob.LobHandler)public Object getResult(CallableStatement cs, int columnIndex) throws SQLException
cs - - the statementcolumnIndex - - the column to get (by index)SQLException - if getting the value failsprotected abstract void setParameterInternal(PreparedStatement ps, int index, Object value, String jdbcType, org.springframework.jdbc.support.lob.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 useSQLException - if thrown by JDBC methodsIOException - if thrown by streaming methodsprotected abstract Object getResultInternal(ResultSet rs, int index, org.springframework.jdbc.support.lob.LobHandler lobHandler) throws SQLException, IOException
rs - the ResultSet to extract fromindex - the index in the ResultSetlobHandler - the LobHandler to useSQLException - if thrown by JDBC methodsIOException - if thrown by streaming methodsCopyright © 2084–2018 dukeware.com. All rights reserved.