Class UserComponentType<T>
- All Implemented Interfaces:
Serializable,BindableType,OutputableType,CompositeType,ProcedureParameterExtractionAware,CompositeTypeImplementor,Type
CompositeUserTypes.- Since:
- 6.3
- Author:
- Gavin King
- See Also:
-
Field Summary
Fields inherited from class org.hibernate.type.ComponentType
propertySpanFields inherited from class org.hibernate.type.AbstractType
LEGACY_DEFAULT_SIZE, LEGACY_DICTATED_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionUserComponentType(Component component, int[] originalPropertyOrder, CompositeUserType<T> compositeUserType) -
Method Summary
Modifier and TypeMethodDescriptionassemble(Serializable object, SharedSessionContractImplementor session, Object owner) Reconstruct the object from its disassembled state.deepCopy(Object component, SessionFactoryImplementor factory) Return a deep copy of the persistent state, stopping at entities and at collections.disassemble(Object value, SessionFactoryImplementor sessionFactory) Return a disassembled representation of the object.disassemble(Object value, SharedSessionContractImplementor session, Object owner) Return a disassembled representation of the object.intGet a hash code, consistent with persistence "equality".intgetHashCode(Object x, SessionFactoryImplementor factory) Get a hash code, consistent with persistence "equality".booleanCompare two instances of the class mapped by this type for persistence "equality", that is, equality of persistent state.booleanisEqual(Object x, Object y, SessionFactoryImplementor factory) Compare two instances of the class mapped by this type for persistence "equality", that is, equality of persistent state.replace(Object original, Object target, SharedSessionContractImplementor session, Object owner, Map<Object, Object> 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.replace(Object original, Object target, SharedSessionContractImplementor session, Object owner, Map<Object, Object> copyCache, ForeignKeyDirection foreignKeyDirection) 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.replacePropertyValues(Object component, Object[] values, SharedSessionContractImplementor session) Inject property values onto the given component instance, or return a new instance with the given property values.Methods inherited from class org.hibernate.type.ComponentType
canDoExtraction, compare, compare, extract, extract, getBindableJavaType, getCascadeStyle, getColumnSpan, getFetchMode, getJdbcType, getMappingModelPart, getName, getOriginalPropertyOrder, getPropertyIndex, getPropertyNames, getPropertyNullability, getPropertyValue, getPropertyValue, getPropertyValueGenerationStrategies, getPropertyValues, getPropertyValues, getReturnedClass, getSqlTypeCodes, getSubtypes, hasNotNullProperty, hasNullProperty, injectMappingModelPart, instantiator, isComponentType, isDirty, isDirty, isEmbedded, isKey, isMethodOf, isModified, isMutable, isSame, mappingModelPart, nullSafeSet, nullSafeSet, resolveExpressible, setPropertyValues, toColumnNullness, toLoggableStringMethods inherited from class org.hibernate.type.AbstractType
beforeAssemble, isAnyType, isAssociationType, isCollectionType, isEntityTypeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.query.BindableType
isInstanceMethods inherited from interface org.hibernate.type.Type
beforeAssemble, getReturnedClassName, getTypeForEqualsHashCode, isAnyType, isAssociationType, isCollectionType, isEntityType
-
Constructor Details
-
UserComponentType
public UserComponentType(Component component, int[] originalPropertyOrder, CompositeUserType<T> compositeUserType)
-
-
Method Details
-
isEqual
Description copied from interface:TypeCompare two instances of the class mapped by this type for persistence "equality", that is, equality of persistent state. For most types this could simply delegate toequals().This should always equate to some form of comparison of the value's internal state. As an example, for Java's
Dateclass, the comparison should be of its internal state, but based only on the specific part which is persistent (the timestamp, date, or time).- Specified by:
isEqualin interfaceType- Overrides:
isEqualin classComponentType- Parameters:
x- The first valuey- The second value- Returns:
- True if there are considered equal (see discussion above).
- Throws:
HibernateException- A problem occurred performing the comparison
-
isEqual
public boolean isEqual(Object x, Object y, SessionFactoryImplementor factory) throws HibernateException Description copied from interface:TypeCompare two instances of the class mapped by this type for persistence "equality", that is, equality of persistent state. For most types this could simply delegate toType.isEqual(Object, Object).This should always equate to some form of comparison of the value's internal state. As an example, for Java's
Dateclass, the comparison should be of its internal state, but based only on the specific part which is persistent (the timestamp, date, or time).- Specified by:
isEqualin interfaceType- Overrides:
isEqualin classComponentType- Parameters:
x- The first valuey- The second valuefactory- The session factory- Returns:
- True if there are considered equal (see discussion above).
- Throws:
HibernateException- A problem occurred performing the comparison
-
getHashCode
Description copied from interface:TypeGet a hash code, consistent with persistence "equality". For most types this could simply delegate to the given value'shashCode.- Specified by:
getHashCodein interfaceType- Overrides:
getHashCodein classComponentType- Parameters:
x- The value for which to retrieve a hash code- Returns:
- The hash code
-
getHashCode
Description copied from interface:TypeGet a hash code, consistent with persistence "equality". For most types this could simply delegate toType.getHashCode(Object).- Specified by:
getHashCodein interfaceType- Overrides:
getHashCodein classComponentType- Parameters:
x- The value for which to retrieve a hash codefactory- The session factory- Returns:
- The hash code
-
deepCopy
Description copied from interface:TypeReturn a deep copy of the persistent state, stopping at entities and at collections.- Specified by:
deepCopyin interfaceType- Overrides:
deepCopyin classComponentType- Parameters:
component- The value to be copiedfactory- The session factory- Returns:
- The deep copy
-
disassemble
public Serializable disassemble(Object value, SessionFactoryImplementor sessionFactory) throws HibernateException Description copied from interface:TypeReturn a disassembled representation of the object. This is the representation that is stored in the second-level cache.A reference to an associated entity should be disassembled to its primary key value.
A high-quality implementation of this method should ensure that:
Objects.equals(disassemble(x,s), disassemble(y,s))== isEqual(x,y,sf)and that:
Objects.equals(x, assemble(disassemble(x,s),s,o))That is, the implementation must be consistent with
Type.isEqual(Object, Object, SessionFactoryImplementor)and withType.assemble(Serializable, SharedSessionContractImplementor, Object).- Specified by:
disassemblein interfaceType- Overrides:
disassemblein classComponentType- Parameters:
value- the value to cachesessionFactory- the session factory- Returns:
- the disassembled, deep cloned state
- Throws:
HibernateException- An error from Hibernate
-