Class ManyToOneType
java.lang.Object
org.hibernate.type.AbstractType
org.hibernate.type.EntityType
org.hibernate.type.ManyToOneType
- All Implemented Interfaces:
Serializable, AssociationType, Type
-
Field Summary
Fields inherited from class EntityType
uniqueKeyPropertyName -
Constructor Summary
ConstructorsConstructorDescriptionManyToOneType(String name, TypeConfiguration typeConfiguration) ManyToOneType(ManyToOneType original, String superTypeEntityName) ManyToOneType(TypeConfiguration typeConfiguration, String referencedEntityName) Creates a many-to-one association type with the given referenced entity.ManyToOneType(TypeConfiguration typeConfiguration, String referencedEntityName, boolean lazy) Creates a many-to-one association type with the given referenced entity and the given laziness characteristicManyToOneType(TypeConfiguration typeConfiguration, String referencedEntityName, boolean referenceToPrimaryKey, String uniqueKeyPropertyName, String propertyName, boolean lazy, boolean unwrapProxy, boolean ignoreNotFound, boolean isLogicalOneToOne) -
Method Summary
Modifier and TypeMethodDescriptionassemble(Serializable oid, SharedSessionContractImplementor session, Object owner) Reconstruct the object from its disassembled state.voidbeforeAssemble(Serializable oid, SharedSessionContractImplementor session) Called before assembling a query result set from the query cache, to allow batch fetching of entities missing from the second-level cache.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?Get the foreign key directionality of this associationint[]getSqlTypeCodes(MappingContext mappingContext) booleanDo we dirty check this association, even when there are no columns to be updated?booleanisDirty(Object old, Object current, boolean[] checkable, SharedSessionContractImplementor session) Should the parent be considered dirty, given both the old and current value?booleanisDirty(Object old, Object current, SharedSessionContractImplementor session) Should the parent be considered dirty, given both the old and current value?booleanIs the association modeled here a 1-1 according to the logical model?booleanisModified(Object old, Object current, boolean[] checkable, SharedSessionContractImplementor session) Has the value been modified compared to the current database state? The difference between this and theType.isDirty(Object, Object, SharedSessionContractImplementor)methods is that here we need to account for "partially" built values.booleanThe nullability of the property.booleanIs the association modeled here defined as a 1-1 in the database (physical model)?boolean[]toColumnNullness(Object value, MappingContext mapping) Given an instance of the type, return an array ofbooleanvalues indicating which mapped columns would be null.booleanIs the primary key of the owning entity table to be used in the join?Methods inherited from class EntityType
compare, compare, deepCopy, getAssociatedEntityName, getAssociatedEntityName, getAssociatedEntityPersister, getAssociatedJoinable, getHashCode, getIdentifier, getIdentifier, getIdentifierEvenIfTransient, getIdentifierOrUniqueKeyPropertyName, getIdentifierOrUniqueKeyType, getLHSPropertyName, getName, getReturnedClass, getRHSUniqueKeyPropertyName, isAssociationType, isEntityType, isEqual, isMutable, isNull, isReferenceToIdentifierProperty, isReferenceToPrimaryKey, isSame, loadByUniqueKey, nullSafeSet, nullSafeSet, replace, requireIdentifierOrUniqueKeyType, resolve, resolveIdentifier, scope, toLoggableString, toStringMethods inherited from class AbstractType
getHashCode, isAnyType, isCollectionType, isComponentType, isEqual, replaceMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Type
getHashCode, getReturnedClassName, getTypeForEqualsHashCode, isAnyType, isCollectionType, isComponentType, isEqual, replace
-
Constructor Details
-
ManyToOneType
Creates a many-to-one association type with the given referenced entity. -
ManyToOneType
public ManyToOneType(TypeConfiguration typeConfiguration, String referencedEntityName, boolean lazy) Creates a many-to-one association type with the given referenced entity and the given laziness characteristic -
ManyToOneType
public ManyToOneType(TypeConfiguration typeConfiguration, String referencedEntityName, boolean referenceToPrimaryKey, String uniqueKeyPropertyName, String propertyName, boolean lazy, boolean unwrapProxy, boolean ignoreNotFound, boolean isLogicalOneToOne) -
ManyToOneType
-
ManyToOneType
-
-
Method Details
-
isNullable
public boolean isNullable()Description copied from class:EntityTypeThe nullability of the property.- Specified by:
isNullablein classEntityType- Returns:
- The nullability of the property.
-
getPropertyName
- Overrides:
getPropertyNamein classEntityType
-
isAlwaysDirtyChecked
public boolean isAlwaysDirtyChecked()Description copied from interface:AssociationTypeDo we dirty check this association, even when there are no columns to be updated? -
isOneToOne
public boolean isOneToOne()Description copied from class:EntityTypeIs the association modeled here defined as a 1-1 in the database (physical model)?- Specified by:
isOneToOnein classEntityType- Returns:
- True if a 1-1 in the database; false otherwise.
-
isLogicalOneToOne
public boolean isLogicalOneToOne()Description copied from class:EntityTypeIs the association modeled here a 1-1 according to the logical model?- Overrides:
isLogicalOneToOnein classEntityType- Returns:
- True if a 1-1 in the logical model; false otherwise.
-
getColumnSpan
Description copied from interface:TypeHow many columns are used to persist this type?Always the same as
getSqlTypCodes(mappingContext).length.- 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(MappingContext).- Parameters:
mappingContext- The mapping contextMappingContext:/- Returns:
- The JDBC type codes.
- Throws:
MappingException- Generally indicates an issue accessing the passed mapping object.
-
getForeignKeyDirection
Description copied from interface:AssociationTypeGet the foreign key directionality of this association -
useLHSPrimaryKey
public boolean useLHSPrimaryKey()Description copied from interface:AssociationTypeIs the primary key of the owning entity table to be used in the join? -
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 classAbstractType- Parameters:
value- the value to cachesessionFactory- the session factory- Returns:
- the disassembled, deep cloned state
- Throws:
HibernateException- An error from Hibernate
-
toColumnNullness
Description copied from interface:TypeGiven an instance of the type, return an array ofbooleanvalues indicating which mapped columns would be null.- Parameters:
value- an instance of the typemapping- The mapping contextMappingContext- Returns:
- array indicating column nullness for a value instance
-