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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classCallback for resource cleanup at the end of a transaction. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionassemble(Serializable cached, Object owner) disassemble(Object value) booleanprotected org.springframework.jdbc.support.lob.LobHandlerRetrieve the configured LobHandler.intintbooleanprotected booleanGet the UseSetString property.booleanReturns ture if we are running with the HSQL hibernate dialect.booleanReturns true if we are running with the MySQL hibernate dialect.booleanReturns true if we are running with the Oracle hibernate dialect.nullSafeGet(ResultSet rs, int index, org.hibernate.engine.spi.SharedSessionContractImplementor session, Object owner) nullSafeGet(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) protected voidsetUseSetClobAsString(boolean b) Set the UseSetString property.int[]sqlTypes()
-
Constructor Details
-
BucketClobStringType
public BucketClobStringType()
-
-
Method Details
-
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
-
getSqlType
public int getSqlType() -
returnedClass
- Specified by:
returnedClassin interfaceorg.hibernate.usertype.UserType
-
equals
- Specified by:
equalsin interfaceorg.hibernate.usertype.UserType
-
deepCopy
- 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:
-
isUseSetClobAsString
protected boolean isUseSetClobAsString()Get the UseSetString property.- Returns:
- the value
- See Also:
-
hashCode
- Specified by:
hashCodein interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateException
-
disassemble
- Specified by:
disassemblein interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateException
-
assemble
- Specified by:
assemblein interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateException
-
replace
public Object replace(Object original, Object target, Object owner) throws org.hibernate.HibernateException - Specified by:
replacein interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateException
-