public class BlobSerializableType extends AbstractLobType
Can also be defined in generic Hibernate 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.
LocalSessionFactoryBean.setLobHandler(org.springframework.jdbc.support.lob.LobHandler)
logger
Modifier | Constructor and Description |
---|---|
|
BlobSerializableType()
Constructor used by Hibernate: fetches config-time LobHandler and
config-time JTA TransactionManager from LocalSessionFactoryBean.
|
protected |
BlobSerializableType(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 |
deepCopy(Object value)
This implementation returns the passed-in value as-is.
|
boolean |
isMutable()
This implementation returns false.
|
protected Object |
nullSafeGetInternal(ResultSet rs,
String[] names,
Object owner,
LobHandler lobHandler)
Template method to extract a value from the given result set.
|
protected void |
nullSafeSetInternal(PreparedStatement ps,
int index,
Object value,
LobCreator lobCreator)
Template method to set the given parameter value on the given statement.
|
Class<?> |
returnedClass() |
int[] |
sqlTypes() |
assemble, disassemble, equals, hashCode, nullSafeGet, nullSafeSet, replace
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
nullSafeGet, nullSafeSet
public BlobSerializableType()
protected BlobSerializableType(LobHandler lobHandler, TransactionManager jtaTransactionManager)
null
).public int[] sqlTypes()
public Class<?> returnedClass()
public boolean isMutable()
AbstractLobType
isMutable
in interface UserType
isMutable
in class AbstractLobType
public Object deepCopy(Object value) throws HibernateException
AbstractLobType
deepCopy
in interface UserType
deepCopy
in class AbstractLobType
HibernateException
protected Object nullSafeGetInternal(ResultSet rs, String[] names, Object owner, LobHandler lobHandler) throws SQLException, IOException, HibernateException
AbstractLobType
nullSafeGetInternal
in class AbstractLobType
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 methodsHibernateException
- in case of any other exceptionsprotected void nullSafeSetInternal(PreparedStatement ps, int index, Object value, LobCreator lobCreator) throws SQLException, IOException
AbstractLobType
nullSafeSetInternal
in class AbstractLobType
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 methods