public abstract class AbstractLobType extends Object implements org.hibernate.usertype.UserType
For writing LOBs, either an active Spring transaction synchronization or an active JTA transaction (with "jtaTransactionManager" specified on LocalSessionFactoryBean or a Hibernate TransactionManagerLookup configured through the corresponding Hibernate property) is required.
Offers template methods for setting parameters and getting result values, passing in the LobHandler or LobCreator to use.
LobHandler
,
LobCreator
,
LocalSessionFactoryBean.setLobHandler(org.springframework.jdbc.support.lob.LobHandler)
,
LocalSessionFactoryBean.setJtaTransactionManager(javax.transaction.TransactionManager)
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
logger |
Modifier | Constructor and Description |
---|---|
protected |
AbstractLobType()
Constructor used by Hibernate: fetches config-time LobHandler and
config-time JTA TransactionManager from LocalSessionFactoryBean.
|
protected |
AbstractLobType(LobHandler lobHandler,
TransactionManager jtaTransactionManager)
Constructor used for testing: takes an explicit LobHandler
and an explicit JTA TransactionManager (can be
null ). |
Modifier and Type | Method and Description |
---|---|
Object |
assemble(Serializable cached,
Object owner)
This implementation returns the passed-in value as-is.
|
Object |
deepCopy(Object value)
This implementation returns the passed-in value as-is.
|
Serializable |
disassemble(Object value)
This implementation returns the passed-in value as-is.
|
boolean |
equals(Object x,
Object y)
This implementation delegates to the Hibernate EqualsHelper.
|
int |
hashCode(Object x)
This implementation returns the hashCode of the given objectz.
|
boolean |
isMutable()
This implementation returns false.
|
Object |
nullSafeGet(ResultSet rs,
String[] names,
Object owner)
This implementation delegates to nullSafeGetInternal,
passing in the LobHandler of this type.
|
protected abstract Object |
nullSafeGetInternal(ResultSet rs,
String[] names,
Object owner,
LobHandler lobHandler)
Template method to extract a value from the given result set.
|
void |
nullSafeSet(PreparedStatement st,
Object value,
int index)
This implementation delegates to nullSafeSetInternal,
passing in a transaction-synchronized LobCreator for the
LobHandler of this type.
|
protected abstract void |
nullSafeSetInternal(PreparedStatement ps,
int index,
Object value,
LobCreator lobCreator)
Template method to set the given parameter value on the given statement.
|
Object |
replace(Object original,
Object target,
Object owner)
This implementation returns the passed-in original as-is.
|
protected AbstractLobType()
protected AbstractLobType(LobHandler lobHandler, TransactionManager jtaTransactionManager)
null
).public boolean isMutable()
isMutable
in interface org.hibernate.usertype.UserType
public boolean equals(Object x, Object y) throws org.hibernate.HibernateException
equals
in interface org.hibernate.usertype.UserType
org.hibernate.HibernateException
EqualsHelper.equals(java.lang.Object, java.lang.Object)
public int hashCode(Object x) throws org.hibernate.HibernateException
hashCode
in interface org.hibernate.usertype.UserType
org.hibernate.HibernateException
public Object deepCopy(Object value) throws org.hibernate.HibernateException
deepCopy
in interface org.hibernate.usertype.UserType
org.hibernate.HibernateException
public Serializable disassemble(Object value) throws org.hibernate.HibernateException
disassemble
in interface org.hibernate.usertype.UserType
org.hibernate.HibernateException
public Object assemble(Serializable cached, Object owner) throws org.hibernate.HibernateException
assemble
in interface org.hibernate.usertype.UserType
org.hibernate.HibernateException
public Object replace(Object original, Object target, Object owner) throws org.hibernate.HibernateException
replace
in interface org.hibernate.usertype.UserType
org.hibernate.HibernateException
public final Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws org.hibernate.HibernateException, SQLException
nullSafeGet
in interface org.hibernate.usertype.UserType
org.hibernate.HibernateException
SQLException
nullSafeGetInternal(java.sql.ResultSet, java.lang.String[], java.lang.Object, org.springframework.jdbc.support.lob.LobHandler)
public final void nullSafeSet(PreparedStatement st, Object value, int index) throws org.hibernate.HibernateException, SQLException
nullSafeSet
in interface org.hibernate.usertype.UserType
org.hibernate.HibernateException
SQLException
nullSafeSetInternal(java.sql.PreparedStatement, int, java.lang.Object, org.springframework.jdbc.support.lob.LobCreator)
protected abstract Object nullSafeGetInternal(ResultSet rs, String[] names, Object owner, LobHandler lobHandler) throws SQLException, IOException, org.hibernate.HibernateException
rs
- the ResultSet to extract fromnames
- the column namesowner
- the containing entitylobHandler
- the LobHandler to useSQLException
- if thrown by JDBC methodsIOException
- if thrown by streaming methodsorg.hibernate.HibernateException
- in case of any other exceptionsprotected abstract void nullSafeSetInternal(PreparedStatement ps, int index, Object value, LobCreator lobCreator) throws SQLException, IOException, org.hibernate.HibernateException
ps
- the PreparedStatement to set onindex
- the statement parameter indexvalue
- the value to setlobCreator
- the LobCreator to useSQLException
- if thrown by JDBC methodsIOException
- if thrown by streaming methodsorg.hibernate.HibernateException
- in case of any other exceptionsCopyright © 2015. All rights reserved.