Class UserComponentType<T>
- All Implemented Interfaces:
Serializable
,BindableType
,OutputableType
,CompositeType
,ProcedureParameterExtractionAware
,CompositeTypeImplementor
,Type
CompositeUserType
s.- Since:
- 6.3
- See Also:
-
Field Summary
Fields inherited from class org.hibernate.type.ComponentType
propertySpan
-
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.int
Get a hash code, consistent with persistence "equality".int
getHashCode
(Object x, SessionFactoryImplementor factory) Get a hash code, consistent with persistence "equality".boolean
Compare two instances of the class mapped by this type for persistence "equality", that is, equality of persistent state.boolean
isEqual
(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, getPropertyValues, getPropertyValues, getReturnedClass, getSqlTypeCodes, getSubtypes, hasNotNullProperty, hasNullProperty, injectMappingModelPart, instantiator, isComponentType, isDirty, isDirty, isEmbedded, isKey, isMethodOf, isModified, isMutable, isSame, mappingModelPart, nullSafeSet, nullSafeSet, resolveExpressible, setPropertyValues, toColumnNullness, toLoggableString
Methods inherited from class org.hibernate.type.AbstractType
beforeAssemble, isAnyType, isAssociationType, isCollectionType, isEntityType
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.hibernate.query.BindableType
isInstance
Methods inherited from interface org.hibernate.type.Type
beforeAssemble, getColumnSpan, getReturnedClassName, getSqlTypeCodes, getTypeForEqualsHashCode, isAnyType, isAssociationType, isCollectionType, isEntityType, toColumnNullness
-
Constructor Details
-
UserComponentType
public UserComponentType(Component component, int[] originalPropertyOrder, CompositeUserType<T> compositeUserType)
-
-
Method Details
-
isEqual
Description copied from interface:Type
Compare 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
Date
class, 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:
isEqual
in interfaceType
- Overrides:
isEqual
in 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:Type
Compare 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
Date
class, 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:
isEqual
in interfaceType
- Overrides:
isEqual
in 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:Type
Get a hash code, consistent with persistence "equality". For most types this could simply delegate to the given value'shashCode
.- Specified by:
getHashCode
in interfaceType
- Overrides:
getHashCode
in classComponentType
- Parameters:
x
- The value for which to retrieve a hash code- Returns:
- The hash code
-
getHashCode
Description copied from interface:Type
Get a hash code, consistent with persistence "equality". For most types this could simply delegate toType.getHashCode(Object)
.- Specified by:
getHashCode
in interfaceType
- Overrides:
getHashCode
in classComponentType
- Parameters:
x
- The value for which to retrieve a hash codefactory
- The session factory- Returns:
- The hash code
-
deepCopy
Description copied from interface:Type
Return a deep copy of the persistent state, stopping at entities and at collections.- Specified by:
deepCopy
in interfaceType
- Overrides:
deepCopy
in 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:Type
Return 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:
disassemble
in interfaceType
- Overrides:
disassemble
in classComponentType
- Parameters:
value
- the value to cachesessionFactory
- the session factory- Returns:
- the disassembled, deep cloned state
- Throws:
HibernateException
- An error from Hibernate
-