org.hibernate.type
Class ImmutableType

java.lang.Object
  extended by org.hibernate.type.AbstractType
      extended by org.hibernate.type.NullableType
          extended by org.hibernate.type.ImmutableType
All Implemented Interfaces:
Serializable, Type
Direct Known Subclasses:
AdaptedImmutableType, BigDecimalType, BigIntegerType, ClassType, CurrencyType, LocaleType, PrimitiveType, StringType, TextType, TimeZoneType

public abstract class ImmutableType
extends NullableType

Superclass of nullable immutable types.

Author:
Gavin King
See Also:
Serialized Form

Constructor Summary
ImmutableType()
           
 
Method Summary
 Object deepCopy(Object value, EntityMode entityMode, SessionFactoryImplementor factory)
          Return a deep copy of the persistent state, stopping at entities and at collections.
 boolean isMutable()
          Are objects of this type mutable.
 Object replace(Object original, Object target, SessionImplementor session, Object owner, Map copyCache)
          During merge, replace the existing (target) value in the entity we are merging to with a new (original) value from the detached entity we are merging.
 
Methods inherited from class org.hibernate.type.NullableType
fromStringValue, fromXMLNode, fromXMLString, get, getColumnSpan, isDirty, isEqual, isEqual, nullSafeGet, nullSafeGet, nullSafeGet, nullSafeGet, nullSafeSet, nullSafeSet, nullSafeSet, nullSafeToString, set, setToXMLNode, sqlType, sqlTypes, toColumnNullness, toLoggableString, toString, toXMLString
 
Methods inherited from class org.hibernate.type.AbstractType
assemble, beforeAssemble, compare, disassemble, getHashCode, getHashCode, getSemiResolvedType, hydrate, isAnyType, isAssociationType, isCollectionType, isComponentType, isDirty, isEntityType, isEqual, isModified, isSame, isXMLElement, replace, replaceNode, resolve, semiResolve
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.hibernate.type.Type
getName, getReturnedClass
 

Constructor Detail

ImmutableType

public ImmutableType()
Method Detail

deepCopy

public final Object deepCopy(Object value,
                             EntityMode entityMode,
                             SessionFactoryImplementor factory)
Description copied from interface: Type
Return a deep copy of the persistent state, stopping at entities and at collections.

Parameters:
value - generally a collection element or entity field
Returns:
Object a copy

isMutable

public final boolean isMutable()
Description copied from interface: Type
Are objects of this type mutable. (With respect to the referencing object ... entities and collections are considered immutable because they manage their own internal state.)

Returns:
boolean

replace

public Object replace(Object original,
                      Object target,
                      SessionImplementor session,
                      Object owner,
                      Map copyCache)
               throws HibernateException
Description copied from interface: Type
During merge, replace the existing (target) value in the entity we are merging to with a new (original) value from the detached entity we are merging. For immutable objects, or null values, it is safe to simply return the first parameter. For mutable objects, it is safe to return a copy of the first parameter. For objects with component values, it might make sense to recursively replace component values.

Parameters:
original - the value from the detached entity being merged
target - the value in the managed entity
Returns:
the value to be merged
Throws:
HibernateException