Package org.hibernate.type
Class SpecialOneToOneType
java.lang.Object
org.hibernate.type.AbstractType
org.hibernate.type.EntityType
org.hibernate.type.OneToOneType
org.hibernate.type.SpecialOneToOneType
- All Implemented Interfaces:
Serializable,AssociationType,Type
A one-to-one association that maps to specific formula(s)
instead of the primary key column of the owning entity.
- See Also:
-
Field Summary
Fields inherited from class org.hibernate.type.EntityType
uniqueKeyPropertyName -
Constructor Summary
ConstructorsConstructorDescriptionSpecialOneToOneType(SpecialOneToOneType original, String superTypeEntityName) SpecialOneToOneType(TypeConfiguration typeConfiguration, String referencedEntityName, ForeignKeyDirection foreignKeyType, boolean referenceToPrimaryKey, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, String entityName, String propertyName, boolean constrained) -
Method Summary
Modifier and TypeMethodDescriptionassemble(Serializable oid, SharedSessionContractImplementor session, Object owner) Reconstruct the object from its disassembled state.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.intgetColumnSpan(MappingContext mapping) How many columns are used to persist this type?int[]getSqlTypeCodes(MappingContext mappingContext) booleanIs the primary key of the owning entity table to be used in the join?Methods inherited from class org.hibernate.type.OneToOneType
getForeignKeyDirection, getPropertyName, isAlwaysDirtyChecked, isDirty, isDirty, isModified, isNull, isNullable, isOneToOne, nullSafeSet, toColumnNullnessMethods inherited from class org.hibernate.type.EntityType
compare, compare, deepCopy, getAssociatedEntityName, getAssociatedEntityName, getAssociatedEntityPersister, getAssociatedJoinable, getHashCode, getIdentifier, getIdentifier, getIdentifierEvenIfTransient, getIdentifierOrUniqueKeyPropertyName, getIdentifierOrUniqueKeyType, getLHSPropertyName, getName, getReturnedClass, getRHSUniqueKeyPropertyName, isAssociationType, isEntityType, isEqual, isLogicalOneToOne, isMutable, isReferenceToIdentifierProperty, isReferenceToPrimaryKey, isSame, loadByUniqueKey, nullSafeSet, replace, requireIdentifierOrUniqueKeyType, resolve, resolveIdentifier, scope, toLoggableString, toStringMethods inherited from class org.hibernate.type.AbstractType
beforeAssemble, getHashCode, isAnyType, isCollectionType, isComponentType, isEqual, replaceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.hibernate.type.Type
beforeAssemble, getHashCode, getReturnedClassName, getTypeForEqualsHashCode, isAnyType, isCollectionType, isComponentType, isEqual, replace
-
Constructor Details
-
SpecialOneToOneType
public SpecialOneToOneType(TypeConfiguration typeConfiguration, String referencedEntityName, ForeignKeyDirection foreignKeyType, boolean referenceToPrimaryKey, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, String entityName, String propertyName, boolean constrained) -
SpecialOneToOneType
-
-
Method Details
-
getColumnSpan
Description copied from interface:TypeHow many columns are used to persist this type?Always the same as
getSqlTypCodes(mappingContext).length.- Specified by:
getColumnSpanin interfaceType- Overrides:
getColumnSpanin classOneToOneType- Parameters:
mapping- The mapping Context objectMappingContext- Returns:
- The number of columns
- Throws:
MappingException- Generally indicates an issue accessing the passed mappingContext object.
-
getSqlTypeCodes
Description copied from interface:TypeReturn the JDBC types codes as defined byTypesorSqlTypesfor the columns mapped by this type.The number of elements in this array must match the return from
Type.getColumnSpan(org.hibernate.type.MappingContext).- Specified by:
getSqlTypeCodesin interfaceType- Overrides:
getSqlTypeCodesin classOneToOneType- Parameters:
mappingContext- The mapping contextMappingContext:/- Returns:
- The JDBC type codes.
- Throws:
MappingException- Generally indicates an issue accessing the passed mapping object.
-
useLHSPrimaryKey
public boolean useLHSPrimaryKey()Description copied from interface:AssociationTypeIs the primary key of the owning entity table to be used in the join?- Specified by:
useLHSPrimaryKeyin interfaceAssociationType- Overrides:
useLHSPrimaryKeyin classOneToOneType
-
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 classOneToOneType- Parameters:
value- the value to cachesessionFactory- the session factory- Returns:
- the disassembled, deep cloned state
- Throws:
HibernateException- An error from Hibernate
-