Package com.atlassian.hibernate
Class BucketClobStringType
- java.lang.Object
-
- com.atlassian.hibernate.BucketClobStringType
-
- All Implemented Interfaces:
Serializable,org.hibernate.usertype.UserType
- Direct Known Subclasses:
CryptographicKeyType,CustomClobType
public class BucketClobStringType extends Object implements org.hibernate.usertype.UserType, Serializable
A custom UserType that maps stings to clobs.This type supports custom handling for:
- Oracle
- MySQL
- HSQL
This custom UserType contains a workaround for the Oracle Clob memory problem. To recap, the issue is that when dealing with Clobs, the oracle drivers will return strings with 64k char[] regardless of the amount of data they hold. So, to fix this we need to release that char[] as quickly as possible, via new String().
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classBucketClobStringType.LobCreatorSynchronizationCallback for resource cleanup at the end of a transaction.
-
Constructor Summary
Constructors Constructor Description BucketClobStringType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectassemble(Serializable cached, Object owner)ObjectdeepCopy(Object value)Serializabledisassemble(Object value)booleanequals(Object x, Object y)protected org.springframework.jdbc.support.lob.LobHandlergetLobHandler()Retrieve the configured LobHandler.inthashCode(Object x)booleanisMutable()protected booleanisUseSetClobAsString()Get the UseSetString property.booleanisUsingHSQL()Returns ture if we are running with the HSQL hibernate dialect.booleanisUsingMySQL()Returns true if we are running with the MySQL hibernate dialect.booleanisUsingOracle()Returns true if we are running with the Oracle hibernate dialect.ObjectnullSafeGet(ResultSet rs, String[] names, org.hibernate.engine.spi.SharedSessionContractImplementor session, Object owner)voidnullSafeSet(PreparedStatement st, Object value, int index, org.hibernate.engine.spi.SharedSessionContractImplementor session)Objectreplace(Object original, Object target, Object owner)ClassreturnedClass()protected voidsetUseSetClobAsString(boolean b)Set the UseSetString property.int[]sqlTypes()
-
-
-
Method Detail
-
isUsingOracle
public boolean isUsingOracle()
Returns true if we are running with the Oracle hibernate dialect.- Returns:
-
isUsingHSQL
public boolean isUsingHSQL()
Returns ture if we are running with the HSQL hibernate dialect.- Returns:
-
isUsingMySQL
public boolean isUsingMySQL()
Returns true if we are running with the MySQL hibernate dialect.- Returns:
-
getLobHandler
protected org.springframework.jdbc.support.lob.LobHandler getLobHandler()
Retrieve the configured LobHandler. This handler may vary with the hibernate dialect.- Returns:
-
sqlTypes
public int[] sqlTypes()
- Specified by:
sqlTypesin interfaceorg.hibernate.usertype.UserType- Returns:
-
returnedClass
public Class returnedClass()
- Specified by:
returnedClassin interfaceorg.hibernate.usertype.UserType
-
equals
public boolean equals(Object x, Object y)
- Specified by:
equalsin interfaceorg.hibernate.usertype.UserType
-
nullSafeGet
public Object nullSafeGet(ResultSet rs, String[] names, org.hibernate.engine.spi.SharedSessionContractImplementor session, Object owner) throws SQLException
- Specified by:
nullSafeGetin interfaceorg.hibernate.usertype.UserType- Throws:
SQLException
-
nullSafeSet
public void nullSafeSet(PreparedStatement st, Object value, int index, org.hibernate.engine.spi.SharedSessionContractImplementor session) throws org.hibernate.HibernateException, SQLException
- Specified by:
nullSafeSetin interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateExceptionSQLException
-
deepCopy
public Object deepCopy(Object value)
- Specified by:
deepCopyin interfaceorg.hibernate.usertype.UserType
-
isMutable
public boolean isMutable()
- Specified by:
isMutablein interfaceorg.hibernate.usertype.UserType
-
setUseSetClobAsString
protected void setUseSetClobAsString(boolean b)
Set the UseSetString property.- Parameters:
b- the value- See Also:
useSetClobAsString
-
isUseSetClobAsString
protected boolean isUseSetClobAsString()
Get the UseSetString property.- Returns:
- the value
- See Also:
useSetClobAsString
-
hashCode
public int hashCode(Object x) throws org.hibernate.HibernateException
- Specified by:
hashCodein interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateException
-
disassemble
public Serializable disassemble(Object value) throws org.hibernate.HibernateException
- Specified by:
disassemblein interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateException
-
assemble
public Object assemble(Serializable cached, Object owner) throws org.hibernate.HibernateException
- Specified by:
assemblein interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateException
-
-