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 class
Callback for resource cleanup at the end of a transaction. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionassemble
(Serializable cached, Object owner) disassemble
(Object value) boolean
protected org.springframework.jdbc.support.lob.LobHandler
Retrieve the configured LobHandler.int
boolean
protected boolean
Get the UseSetString property.boolean
Returns ture if we are running with the HSQL hibernate dialect.boolean
Returns true if we are running with the MySQL hibernate dialect.boolean
Returns true if we are running with the Oracle hibernate dialect.nullSafeGet
(ResultSet rs, String[] names, org.hibernate.engine.spi.SharedSessionContractImplementor session, Object owner) void
nullSafeSet
(PreparedStatement st, Object value, int index, org.hibernate.engine.spi.SharedSessionContractImplementor session) protected void
setUseSetClobAsString
(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:
sqlTypes
in interfaceorg.hibernate.usertype.UserType
- Returns:
-
returnedClass
- Specified by:
returnedClass
in interfaceorg.hibernate.usertype.UserType
-
equals
- Specified by:
equals
in interfaceorg.hibernate.usertype.UserType
-
deepCopy
- Specified by:
deepCopy
in interfaceorg.hibernate.usertype.UserType
-
isMutable
public boolean isMutable()- Specified by:
isMutable
in 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
- Specified by:
hashCode
in interfaceorg.hibernate.usertype.UserType
- Throws:
org.hibernate.HibernateException
-
disassemble
- Specified by:
disassemble
in interfaceorg.hibernate.usertype.UserType
- Throws:
org.hibernate.HibernateException
-
assemble
- Specified by:
assemble
in interfaceorg.hibernate.usertype.UserType
- Throws:
org.hibernate.HibernateException
-
replace
public Object replace(Object original, Object target, Object owner) throws org.hibernate.HibernateException - Specified by:
replace
in interfaceorg.hibernate.usertype.UserType
- Throws:
org.hibernate.HibernateException
-