类 ManyToOneType
- java.lang.Object
-
- org.hibernate.type.AbstractType
-
- org.hibernate.type.EntityType
-
- org.hibernate.type.ManyToOneType
-
- 所有已实现的接口:
Serializable,AssociationType,Type
public class ManyToOneType extends EntityType
A many-to-one association to an entity.- 作者:
- Gavin King
- 另请参阅:
- 序列化表格
-
-
字段概要
-
从类继承的字段 org.hibernate.type.EntityType
uniqueKeyPropertyName
-
从类继承的字段 org.hibernate.type.AbstractType
LEGACY_DEFAULT_SIZE, LEGACY_DICTATED_SIZE
-
-
构造器概要
构造器 构造器 说明 ManyToOneType(ManyToOneType original, String superTypeEntityName)ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName)Creates a many-to-one association type with the given referenced entity.ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, boolean lazy)Creates a many-to-one association type with the given referenced entity and the given laziness characteristicManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, boolean referenceToPrimaryKey, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, boolean ignoreNotFound, boolean isLogicalOneToOne)ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, boolean referenceToPrimaryKey, String uniqueKeyPropertyName, String propertyName, boolean lazy, boolean unwrapProxy, boolean ignoreNotFound, boolean isLogicalOneToOne)ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, boolean isEmbeddedInXML, boolean ignoreNotFound, boolean isLogicalOneToOne)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 Objectassemble(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.Size[]defaultSizes(Mapping mapping)Defines the column sizes to use according to this type if the user did not explicitly say (and if noType.dictatedSizes(org.hibernate.engine.spi.Mapping)were given).Size[]dictatedSizes(Mapping mapping)Return the column sizes dictated by this type.Serializabledisassemble(Object value, SharedSessionContractImplementor session, Object owner)Return a disassembled representation of the object.intgetColumnSpan(Mapping mapping)How many columns are used to persist this type.ForeignKeyDirectiongetForeignKeyDirection()Get the foreign key directionality of this associationStringgetPropertyName()Objecthydrate(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)Extract a value from the JDBC result set.booleanisAlwaysDirtyChecked()Do 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?booleanisLogicalOneToOne()Is 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?booleanisNullable()The nullability of the property.booleanisOneToOne()Is the association modeled here defined as a 1-1 in the database (physical model)?Objectresolve(Object value, SharedSessionContractImplementor session, Object owner, Boolean overridingEager)The second phase of 2-phase loading.int[]sqlTypes(Mapping mapping)Return the JDBC types codes (perTypes) for the columns mapped by this type.boolean[]toColumnNullness(Object value, Mapping mapping)Given an instance of the type, return an array of boolean, indicating which mapped columns would be null.booleanuseLHSPrimaryKey()Is the primary key of the owning entity table to be used in the join?-
从类继承的方法 org.hibernate.type.EntityType
compare, deepCopy, getAssociatedEntityName, getAssociatedEntityName, getAssociatedEntityPersister, getAssociatedJoinable, getHashCode, getIdentifier, getIdentifierOrUniqueKeyPropertyName, getIdentifierOrUniqueKeyType, getLHSPropertyName, getName, getOnCondition, getOnCondition, getReturnedClass, getRHSUniqueKeyPropertyName, getSemiResolvedType, isAssociationType, isEntityType, isEqual, isMutable, isNull, isReferenceToPrimaryKey, isSame, loadByUniqueKey, nullSafeGet, nullSafeGet, nullSafeSet, nullSafeSet, replace, requireIdentifierOrUniqueKeyType, resolve, resolveIdentifier, resolveIdentifier, scope, toLoggableString, toString
-
从类继承的方法 org.hibernate.type.AbstractType
getHashCode, isAnyType, isCollectionType, isComponentType, isEqual, replace, semiResolve
-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
从接口继承的方法 org.hibernate.type.Type
getHashCode, isAnyType, isCollectionType, isComponentType, isEqual, replace, semiResolve
-
-
-
-
构造器详细资料
-
ManyToOneType
public ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName)
Creates a many-to-one association type with the given referenced entity.- 参数:
scope- The scope for this instance.referencedEntityName- The name iof the referenced entity
-
ManyToOneType
public ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, boolean lazy)
Creates a many-to-one association type with the given referenced entity and the given laziness characteristic- 参数:
scope- The scope for this instance.referencedEntityName- The name iof the referenced entitylazy- Should the association be handled lazily
-
ManyToOneType
@Deprecated public ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, boolean isEmbeddedInXML, boolean ignoreNotFound, boolean isLogicalOneToOne)
-
ManyToOneType
@Deprecated public ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, boolean referenceToPrimaryKey, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, boolean ignoreNotFound, boolean isLogicalOneToOne)
-
ManyToOneType
public ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, boolean referenceToPrimaryKey, String uniqueKeyPropertyName, String propertyName, boolean lazy, boolean unwrapProxy, boolean ignoreNotFound, boolean isLogicalOneToOne)
-
ManyToOneType
public ManyToOneType(ManyToOneType original, String superTypeEntityName)
-
-
方法详细资料
-
isNullable
public boolean isNullable()
从类复制的说明:EntityTypeThe nullability of the property.- 指定者:
isNullable在类中EntityType- 返回:
- The nullability of the property.
-
getPropertyName
public String getPropertyName()
- 覆盖:
getPropertyName在类中EntityType
-
isAlwaysDirtyChecked
public boolean isAlwaysDirtyChecked()
从接口复制的说明:AssociationTypeDo we dirty check this association, even when there are no columns to be updated?
-
isOneToOne
public boolean isOneToOne()
从类复制的说明:EntityTypeIs the association modeled here defined as a 1-1 in the database (physical model)?- 指定者:
isOneToOne在类中EntityType- 返回:
- True if a 1-1 in the database; false otherwise.
-
isLogicalOneToOne
public boolean isLogicalOneToOne()
从类复制的说明:EntityTypeIs the association modeled here a 1-1 according to the logical model?- 覆盖:
isLogicalOneToOne在类中EntityType- 返回:
- True if a 1-1 in the logical model; false otherwise.
-
getColumnSpan
public int getColumnSpan(Mapping mapping) throws MappingException
从接口复制的说明:TypeHow many columns are used to persist this type. Always the same assqlTypes(mapping).length- 参数:
mapping- The mapping object :/- 返回:
- The number of columns
- 抛出:
MappingException- Generally indicates an issue accessing the passed mapping object.
-
sqlTypes
public int[] sqlTypes(Mapping mapping) throws MappingException
从接口复制的说明:TypeReturn the JDBC types codes (perTypes) for the columns mapped by this type. NOTE: The number of elements in this array matches the return fromType.getColumnSpan(org.hibernate.engine.spi.Mapping).- 参数:
mapping- The mapping object :/- 返回:
- The JDBC type codes.
- 抛出:
MappingException- Generally indicates an issue accessing the passed mapping object.
-
dictatedSizes
public Size[] dictatedSizes(Mapping mapping) throws MappingException
从接口复制的说明:TypeReturn the column sizes dictated by this type. For example, the mapping for achar/Characterwould have a dictated length limit of 1; for a string-basedUUIDwould have a size limit of 36; etc. NOTE: The number of elements in this array matches the return fromType.getColumnSpan(org.hibernate.engine.spi.Mapping).- 参数:
mapping- The mapping object :/- 返回:
- The dictated sizes.
- 抛出:
MappingException- Generally indicates an issue accessing the passed mapping object.
-
defaultSizes
public Size[] defaultSizes(Mapping mapping) throws MappingException
从接口复制的说明:TypeDefines the column sizes to use according to this type if the user did not explicitly say (and if noType.dictatedSizes(org.hibernate.engine.spi.Mapping)were given). NOTE: The number of elements in this array matches the return fromType.getColumnSpan(org.hibernate.engine.spi.Mapping).- 参数:
mapping- The mapping object :/- 返回:
- The default sizes.
- 抛出:
MappingException- Generally indicates an issue accessing the passed mapping object.
-
getForeignKeyDirection
public ForeignKeyDirection getForeignKeyDirection()
从接口复制的说明:AssociationTypeGet the foreign key directionality of this association
-
hydrate
public Object hydrate(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException
从接口复制的说明:TypeExtract a value from the JDBC result set. This is useful for 2-phase property initialization - the second phase is a call toType.resolve(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)This hydrated value will be either:- in the case of an entity or collection type, the key
- otherwise, the value itself
- 指定者:
hydrate在接口中Type- 覆盖:
hydrate在类中AbstractType- 参数:
rs- The JDBC result setnames- the column names making up this type value (use to read from result set)session- The originating sessionowner- the parent entity- 返回:
- An entity or collection key, or an actual value.
- 抛出:
HibernateException- An error from HibernateSQLException- An error from the JDBC driver- 另请参阅:
Type.resolve(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)
-
useLHSPrimaryKey
public boolean useLHSPrimaryKey()
从接口复制的说明:AssociationTypeIs the primary key of the owning entity table to be used in the join?
-
isModified
public boolean isModified(Object old, Object current, boolean[] checkable, SharedSessionContractImplementor session) throws HibernateException
从接口复制的说明:TypeHas the value been modified compared to the current database state? The difference between this and theType.isDirty(java.lang.Object, java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor)methods is that here we need to account for "partially" built values. This is really only an issue with association types. For most type implementations it is enough to simply delegate toType.isDirty(java.lang.Object, java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor)here/- 指定者:
isModified在接口中Type- 覆盖:
isModified在类中AbstractType- 参数:
old- the database state, in a "hydrated" form, with identifiers unresolvedcurrent- the current state of the objectcheckable- which columns are actually checkablesession- The session from which the request originated.- 返回:
- true if the field has been modified
- 抛出:
HibernateException- A problem occurred performing the checking
-
resolve
public Object resolve(Object value, SharedSessionContractImplementor session, Object owner, Boolean overridingEager) throws HibernateException
从接口复制的说明:TypeThe second phase of 2-phase loading. Only really pertinent for entities and collections. Here we resolve the identifier to an entity or collection instance- 指定者:
resolve在接口中Type- 覆盖:
resolve在类中EntityType- 参数:
value- an identifier or value returned by hydrate()session- the sessionowner- the parent entityoverridingEager- can override eager from the mapping. For example because ofLoadQueryInfluencersIf null, then it does not override. If true or false then it overrides the mapping value.- 返回:
- the given value, or the value associated with the identifier
- 抛出:
HibernateException- An error from Hibernate- 另请参阅:
Type.hydrate(java.sql.ResultSet, java.lang.String[], org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)
-
disassemble
public Serializable disassemble(Object value, SharedSessionContractImplementor session, Object owner) throws HibernateException
从接口复制的说明:TypeReturn a disassembled representation of the object. This is the value Hibernate will use in second level caching, so care should be taken to break values down to their simplest forms; for entities especially, this means breaking them down into their constituent parts.- 指定者:
disassemble在接口中Type- 覆盖:
disassemble在类中AbstractType- 参数:
value- the value to cachesession- the originating sessionowner- optional parent entity object (needed for collections)- 返回:
- the disassembled, deep cloned state
- 抛出:
HibernateException- An error from Hibernate
-
assemble
public Object assemble(Serializable oid, SharedSessionContractImplementor session, Object owner) throws HibernateException
从接口复制的说明:TypeReconstruct the object from its disassembled state. This method is the reciprocal ofType.disassemble(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)- 指定者:
assemble在接口中Type- 覆盖:
assemble在类中AbstractType- 参数:
oid- the disassembled state from the cachesession- the originating sessionowner- the parent entity object- 返回:
- the (re)assembled object
- 抛出:
HibernateException- An error from Hibernate
-
beforeAssemble
public void beforeAssemble(Serializable oid, SharedSessionContractImplementor session)
从接口复制的说明:TypeCalled before assembling a query result set from the query cache, to allow batch fetching of entities missing from the second-level cache.- 指定者:
beforeAssemble在接口中Type- 覆盖:
beforeAssemble在类中AbstractType- 参数:
oid- The keysession- The originating session
-
toColumnNullness
public boolean[] toColumnNullness(Object value, Mapping mapping)
从接口复制的说明:TypeGiven an instance of the type, return an array of boolean, indicating which mapped columns would be null.- 参数:
value- an instance of the typemapping- The mapping abstraction- 返回:
- array indicating column nullness for a value instance
-
isDirty
public boolean isDirty(Object old, Object current, SharedSessionContractImplementor session) throws HibernateException
从接口复制的说明:TypeShould the parent be considered dirty, given both the old and current value?- 指定者:
isDirty在接口中Type- 覆盖:
isDirty在类中AbstractType- 参数:
old- the old valuecurrent- the current valuesession- The session from which the request originated.- 返回:
- true if the field is dirty
- 抛出:
HibernateException- A problem occurred performing the checking
-
isDirty
public boolean isDirty(Object old, Object current, boolean[] checkable, SharedSessionContractImplementor session) throws HibernateException
从接口复制的说明:TypeShould the parent be considered dirty, given both the old and current value?- 参数:
old- the old valuecurrent- the current valuecheckable- An array of booleans indicating which columns making up the value are actually checkablesession- The session from which the request originated.- 返回:
- true if the field is dirty
- 抛出:
HibernateException- A problem occurred performing the checking
-
-