com.atlassian.hibernate
Class BucketClobStringType

java.lang.Object
  extended by com.atlassian.hibernate.BucketClobStringType
All Implemented Interfaces:
net.sf.hibernate.UserType
Direct Known Subclasses:
CryptographicKeyType, CustomClobType

public class BucketClobStringType
extends java.lang.Object
implements net.sf.hibernate.UserType

A custom UserType that maps stings to clobs. This type supports custom handling for:

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().


Nested Class Summary
protected static class BucketClobStringType.LobCreatorSynchronization
          Callback for resource cleanup at the end of a transaction.
 
Constructor Summary
BucketClobStringType()
           
 
Method Summary
 java.lang.Object deepCopy(java.lang.Object value)
           
 boolean equals(java.lang.Object x, java.lang.Object y)
           
protected  org.springframework.jdbc.support.lob.LobHandler getLobHandler()
          Retrieve the configured LobHandler.
 boolean isMutable()
           
protected  boolean isUseSetClobAsString()
          Get the UseSetString property.
 boolean isUsingHSQL()
          Returns ture if we are running with the HSQL hibernate dialect.
 boolean isUsingMySQL()
          Returns true if we are running with the MySQL hibernate dialect.
 boolean isUsingOracle()
          Returns true if we are running with the Oracle hibernate dialect.
 java.lang.Object nullSafeGet(java.sql.ResultSet rs, java.lang.String[] names, java.lang.Object owner)
           
 void nullSafeSet(java.sql.PreparedStatement st, java.lang.Object value, int index)
           
 java.lang.Class returnedClass()
           
protected  void setUseSetClobAsString(boolean b)
          Set the UseSetString property.
 int[] sqlTypes()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BucketClobStringType

public BucketClobStringType()
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:
sqlTypes in interface net.sf.hibernate.UserType
Returns:

returnedClass

public java.lang.Class returnedClass()
Specified by:
returnedClass in interface net.sf.hibernate.UserType

equals

public boolean equals(java.lang.Object x,
                      java.lang.Object y)
Specified by:
equals in interface net.sf.hibernate.UserType

nullSafeGet

public java.lang.Object nullSafeGet(java.sql.ResultSet rs,
                                    java.lang.String[] names,
                                    java.lang.Object owner)
                             throws java.sql.SQLException
Specified by:
nullSafeGet in interface net.sf.hibernate.UserType
Throws:
java.sql.SQLException

nullSafeSet

public void nullSafeSet(java.sql.PreparedStatement st,
                        java.lang.Object value,
                        int index)
                 throws java.sql.SQLException
Specified by:
nullSafeSet in interface net.sf.hibernate.UserType
Throws:
java.sql.SQLException

deepCopy

public java.lang.Object deepCopy(java.lang.Object value)
Specified by:
deepCopy in interface net.sf.hibernate.UserType

isMutable

public boolean isMutable()
Specified by:
isMutable in interface net.sf.hibernate.UserType

setUseSetClobAsString

protected void setUseSetClobAsString(boolean b)
Set the UseSetString property.

Parameters:
b -
See Also:
useSetClobAsString

isUseSetClobAsString

protected boolean isUseSetClobAsString()
Get the UseSetString property.

Returns:
See Also:
useSetClobAsString


Copyright © 2003-2014 Atlassian. All Rights Reserved.