Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.orm.hibernate.support
Class AbstractLobType

    java.lang.Object
      org.springframework.orm.hibernate.support.AbstractLobType

All Implemented Interfaces:
  net.sf.hibernate.UserType

Direct Known Subclasses:
  BlobByteArrayType, BlobSerializableType, BlobStringType, ClobStringType

    public abstract class AbstractLobType

extends Object
implements net.sf.hibernate.UserType

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) is required.

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

Since:
  1.1
Author:
  Juergen Hoeller
See Also:
  `LobHandler`, `LobCreator`, `LocalSessionFactoryBean.setLobHandler(org.springframework.jdbc.support.lob.LobHandler)`, `LocalSessionFactoryBean.setJtaTransactionManager(javax.transaction.TransactionManager)`

Field Summary
`static int` | `LOB_CREATOR_SYNCHRONIZATION_ORDER` Order value for TransactionSynchronization objects that clean up LobCreators.
`protected Log` | `logger`

Constructor Summary
`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`).

Method Summary
`Object` | `deepCopy(Object value)` This implementation returns the passed-in value as-is.
`boolean` | `equals(Object x, Object y)` This implementation delegates to the Hibernate EqualsHelper.
`boolean` | `isMutable()` This implementation returns false.
`Object` | `nullSafeGet(ResultSet rs, String[] names, Object owner)` This implementation delegates to nullSafeGetInternal, passing in the LobHandler of this type.
`protected abstract Object` | `nullSafeGetInternal(ResultSet rs, int index, LobHandler lobHandler)` Template method to extract a value from the given result set.
`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.
`protected abstract void` | `nullSafeSetInternal(PreparedStatement ps, int index, Object value, LobCreator lobCreator)` Template method to set the given parameter value on the given statement.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface net.sf.hibernate.UserType
`returnedClass, sqlTypes`

Field Detail

### LOB_CREATOR_SYNCHRONIZATION_ORDER

    public static final int LOB_CREATOR_SYNCHRONIZATION_ORDER

  Order value for TransactionSynchronization objects that clean up LobCreators. Return SessionFactoryUtils.SESSION_SYNCHRONIZATION_ORDER - 100 to execute LobCreator cleanup before Hibernate Session and JDBC Connection cleanup, if any.

  See Also:
    `SessionFactoryUtils.SESSION_SYNCHRONIZATION_ORDER`, Constant Field Values

### logger

    protected final Log logger

Constructor Detail

### AbstractLobType

    protected AbstractLobType()

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

  See Also:
    `LocalSessionFactoryBean.getConfigTimeLobHandler()`, `LocalSessionFactoryBean.getConfigTimeTransactionManager()`

### AbstractLobType

    protected AbstractLobType(LobHandler lobHandler,
                              TransactionManager jtaTransactionManager)

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

Method Detail

### isMutable

    public boolean isMutable()

  This implementation returns false.

  Specified by:
    `isMutable` in interface `net.sf.hibernate.UserType`

### equals

    public boolean equals(Object x,
                          Object y)
                   throws net.sf.hibernate.HibernateException

  This implementation delegates to the Hibernate EqualsHelper.

  Specified by:
    `equals` in interface `net.sf.hibernate.UserType`
  Throws:
    `net.sf.hibernate.HibernateException`
  See Also:
    `EqualsHelper.equals(java.lang.Object, java.lang.Object)`

### deepCopy

    public Object deepCopy(Object value)
                    throws net.sf.hibernate.HibernateException

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

  Specified by:
    `deepCopy` in interface `net.sf.hibernate.UserType`
  Throws:
    `net.sf.hibernate.HibernateException`

### nullSafeGet

    public final Object nullSafeGet(ResultSet rs,
                                    String[] names,
                                    Object owner)
                             throws net.sf.hibernate.HibernateException,
                                    SQLException

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

  Specified by:
    `nullSafeGet` in interface `net.sf.hibernate.UserType`
  Throws:
    `net.sf.hibernate.HibernateException`
    `SQLException`
  See Also:
    `nullSafeGetInternal(java.sql.ResultSet, int, org.springframework.jdbc.support.lob.LobHandler)`

### nullSafeSet

    public final void nullSafeSet(PreparedStatement st,
                                  Object value,
                                  int index)
                           throws net.sf.hibernate.HibernateException,
                                  SQLException

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

  Specified by:
    `nullSafeSet` in interface `net.sf.hibernate.UserType`
  Throws:
    `net.sf.hibernate.HibernateException`
    `SQLException`
  See Also:
    `nullSafeSetInternal(java.sql.PreparedStatement, int, java.lang.Object, org.springframework.jdbc.support.lob.LobCreator)`

### nullSafeGetInternal

    protected abstract Object nullSafeGetInternal(ResultSet rs,
                                                  int index,
                                                  LobHandler lobHandler)
                                           throws SQLException,
                                                  IOException,
                                                  net.sf.hibernate.HibernateException

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

  Parameters:
    `rs` - the ResultSet to extract from
    `index` - the index in the ResultSet
    `lobHandler` - the LobHandler to use
  Returns:
    the extracted value
  Throws:
    `SQLException` - if thrown by JDBC methods
    `IOException` - if thrown by streaming methods
    `net.sf.hibernate.HibernateException` - in case of any other exceptions

### nullSafeSetInternal

    protected abstract void nullSafeSetInternal(PreparedStatement ps,
                                                int index,
                                                Object value,
                                                LobCreator lobCreator)
                                         throws SQLException,
                                                IOException,
                                                net.sf.hibernate.HibernateException

  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
    `net.sf.hibernate.HibernateException` - in case of any other exceptions

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2007 The Spring Framework.