public abstract class

AbstractLobType

extends Object
java.lang.Object
   ↳ org.springframework.orm.hibernate3.support.AbstractLobType
Known Direct Subclasses

Class Overview

Abstract base class for Hibernate UserType implementations that map to LOBs. Retrieves the LobHandler to use from LocalSessionFactoryBean at config time.

For writing LOBs, either an active Spring transaction synchronization or an active JTA transaction (with "jtaTransactionManager" specified on LocalSessionFactoryBean or a Hibernate TransactionManagerLookup configured through the corresponding Hibernate property) is required.

Offers template methods for setting parameters and getting result values, passing in the LobHandler or LobCreator to use.

Summary

Fields
protected final Log logger
Protected Constructors
AbstractLobType()
Constructor used by Hibernate: fetches config-time LobHandler and config-time JTA TransactionManager from LocalSessionFactoryBean.
AbstractLobType(LobHandler lobHandler, TransactionManager jtaTransactionManager)
Constructor used for testing: takes an explicit LobHandler and an explicit JTA TransactionManager (can be null).
Public Methods
Object assemble(Serializable cached, Object owner)
This implementation returns the passed-in value as-is.
Object deepCopy(Object value)
This implementation returns the passed-in value as-is.
Serializable disassemble(Object value)
This implementation returns the passed-in value as-is.
boolean equals(Object x, Object y)
This implementation delegates to the Hibernate EqualsHelper.
int hashCode(Object x)
This implementation returns the hashCode of the given objectz.
boolean isMutable()
This implementation returns false.
final Object nullSafeGet(ResultSet rs, String[] names, Object owner)
This implementation delegates to nullSafeGetInternal, passing in the LobHandler of this type.
final void nullSafeSet(PreparedStatement st, Object value, int index)
This implementation delegates to nullSafeSetInternal, passing in a transaction-synchronized LobCreator for the LobHandler of this type.
Object replace(Object original, Object target, Object owner)
This implementation returns the passed-in original as-is.
Protected Methods
abstract Object nullSafeGetInternal(ResultSet rs, String[] names, Object owner, LobHandler lobHandler)
Template method to extract a value from the given result set.
abstract void nullSafeSetInternal(PreparedStatement ps, int index, Object value, LobCreator lobCreator)
Template method to set the given parameter value on the given statement.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected final Log logger

Protected Constructors

protected AbstractLobType ()

Constructor used by Hibernate: fetches config-time LobHandler and config-time JTA TransactionManager from LocalSessionFactoryBean.

protected AbstractLobType (LobHandler lobHandler, TransactionManager jtaTransactionManager)

Constructor used for testing: takes an explicit LobHandler and an explicit JTA TransactionManager (can be null).

Public Methods

public Object assemble (Serializable cached, Object owner)

This implementation returns the passed-in value as-is.

Throws
HibernateException

public Object deepCopy (Object value)

This implementation returns the passed-in value as-is.

Throws
HibernateException

public Serializable disassemble (Object value)

This implementation returns the passed-in value as-is.

Throws
HibernateException

public boolean equals (Object x, Object y)

This implementation delegates to the Hibernate EqualsHelper.

Throws
HibernateException
See Also
  • org.hibernate.util.EqualsHelper#equals

public int hashCode (Object x)

This implementation returns the hashCode of the given objectz.

Throws
HibernateException

public boolean isMutable ()

This implementation returns false.

public final Object nullSafeGet (ResultSet rs, String[] names, Object owner)

This implementation delegates to nullSafeGetInternal, passing in the LobHandler of this type.

Throws
HibernateException
SQLException

public final void nullSafeSet (PreparedStatement st, Object value, int index)

This implementation delegates to nullSafeSetInternal, passing in a transaction-synchronized LobCreator for the LobHandler of this type.

Throws
HibernateException
SQLException

public Object replace (Object original, Object target, Object owner)

This implementation returns the passed-in original as-is.

Throws
HibernateException

Protected Methods

protected abstract Object nullSafeGetInternal (ResultSet rs, String[] names, Object owner, LobHandler lobHandler)

Template method to extract a value from the given result set.

Parameters
rs the ResultSet to extract from
names the column names
owner the containing entity
lobHandler the LobHandler to use
Returns
  • the extracted value
Throws
SQLException if thrown by JDBC methods
IOException if thrown by streaming methods
in case of any other exceptions
HibernateException

protected abstract void nullSafeSetInternal (PreparedStatement ps, int index, Object value, LobCreator lobCreator)

Template method to set the given parameter value on the given statement.

Parameters
ps the PreparedStatement to set on
index the statement parameter index
value the value to set
lobCreator the LobCreator to use
Throws
SQLException if thrown by JDBC methods
IOException if thrown by streaming methods
in case of any other exceptions
HibernateException