类 OneToOneType
- java.lang.Object
-
- org.hibernate.type.AbstractType
-
- org.hibernate.type.EntityType
-
- org.hibernate.type.OneToOneType
-
- 所有已实现的接口:
Serializable,AssociationType,Type
- 直接已知子类:
SpecialOneToOneType
public class OneToOneType extends EntityType
A one-to-one association to an entity- 作者:
- Gavin King
- 另请参阅:
- 序列化表格
-
-
字段概要
-
从类继承的字段 org.hibernate.type.EntityType
uniqueKeyPropertyName
-
从类继承的字段 org.hibernate.type.AbstractType
LEGACY_DEFAULT_SIZE, LEGACY_DICTATED_SIZE
-
-
构造器概要
构造器 构造器 说明 OneToOneType(OneToOneType original, String superTypeEntityName)OneToOneType(TypeFactory.TypeScope scope, String referencedEntityName, ForeignKeyDirection foreignKeyType, boolean referenceToPrimaryKey, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, String entityName, String propertyName)OneToOneType(TypeFactory.TypeScope scope, String referencedEntityName, ForeignKeyDirection foreignKeyType, boolean referenceToPrimaryKey, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, String entityName, String propertyName, boolean constrained)OneToOneType(TypeFactory.TypeScope scope, String referencedEntityName, ForeignKeyDirection foreignKeyType, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, String entityName, String propertyName)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 Objectassemble(Serializable oid, SharedSessionContractImplementor session, Object owner)Reconstruct the object from its disassembled state.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 session)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()We don't need to dirty check one-to-one because of how assemble/disassemble is implemented and because a one-to-one association is never dirtybooleanisDirty(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?booleanisModified(Object old, Object current, boolean[] checkable, SharedSessionContractImplementor session)Has the value been modified compared to the current database state?booleanisNull(Object owner, SharedSessionContractImplementor session)booleanisNullable()The nullability of the property.booleanisOneToOne()Is the association modeled here defined as a 1-1 in the database (physical model)?voidnullSafeSet(PreparedStatement st, Object value, int index, boolean[] settable, SharedSessionContractImplementor session)Bind a value represented by an instance of themapped classto the JDBC prepared statement, ignoring some columns as dictated by the 'settable' parameter.int[]sqlTypes(Mapping session)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, isLogicalOneToOne, isMutable, isReferenceToPrimaryKey, isSame, loadByUniqueKey, nullSafeGet, nullSafeGet, nullSafeSet, replace, requireIdentifierOrUniqueKeyType, resolve, resolve, resolveIdentifier, resolveIdentifier, scope, toLoggableString, toString
-
从类继承的方法 org.hibernate.type.AbstractType
beforeAssemble, getHashCode, isAnyType, isCollectionType, isComponentType, isEqual, replace, semiResolve
-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
从接口继承的方法 org.hibernate.type.Type
beforeAssemble, getHashCode, isAnyType, isCollectionType, isComponentType, isEqual, replace, semiResolve
-
-
-
-
构造器详细资料
-
OneToOneType
@Deprecated public OneToOneType(TypeFactory.TypeScope scope, String referencedEntityName, ForeignKeyDirection foreignKeyType, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, String entityName, String propertyName)
-
OneToOneType
@Deprecated public OneToOneType(TypeFactory.TypeScope scope, String referencedEntityName, ForeignKeyDirection foreignKeyType, boolean referenceToPrimaryKey, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, String entityName, String propertyName)
-
OneToOneType
public OneToOneType(TypeFactory.TypeScope scope, String referencedEntityName, ForeignKeyDirection foreignKeyType, boolean referenceToPrimaryKey, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, String entityName, String propertyName, boolean constrained)
-
OneToOneType
public OneToOneType(OneToOneType original, String superTypeEntityName)
-
-
方法详细资料
-
getPropertyName
public String getPropertyName()
- 覆盖:
getPropertyName在类中EntityType
-
isNull
public boolean isNull(Object owner, SharedSessionContractImplementor session)
- 覆盖:
isNull在类中EntityType
-
getColumnSpan
public int getColumnSpan(Mapping session) throws MappingException
从接口复制的说明:TypeHow many columns are used to persist this type. Always the same assqlTypes(mapping).length- 参数:
session- The mapping object :/- 返回:
- The number of columns
- 抛出:
MappingException- Generally indicates an issue accessing the passed mapping object.
-
sqlTypes
public int[] sqlTypes(Mapping session) 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).- 参数:
session- 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.
-
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
-
nullSafeSet
public void nullSafeSet(PreparedStatement st, Object value, int index, boolean[] settable, SharedSessionContractImplementor session)
从接口复制的说明:TypeBind a value represented by an instance of themapped classto the JDBC prepared statement, ignoring some columns as dictated by the 'settable' parameter. Implementors should handle the possibility of null values. A multi-column type should bind parameters starting from index.- 指定者:
nullSafeSet在接口中Type- 覆盖:
nullSafeSet在类中EntityType- 参数:
st- The JDBC prepared statement to which to bindvalue- the object to writeindex- starting parameter bind indexsettable- an array indicating which columns to bind/ignoresession- The originating session
-
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.
-
isDirty
public boolean isDirty(Object old, Object current, SharedSessionContractImplementor session)
从接口复制的说明: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
-
isDirty
public boolean isDirty(Object old, Object current, boolean[] checkable, SharedSessionContractImplementor session)
从接口复制的说明: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
-
isModified
public boolean isModified(Object old, Object current, boolean[] checkable, SharedSessionContractImplementor session)
从接口复制的说明: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
-
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)
-
isNullable
public boolean isNullable()
从类复制的说明:EntityTypeThe nullability of the property.- 指定者:
isNullable在类中EntityType- 返回:
- The nullability of the property.
-
useLHSPrimaryKey
public boolean useLHSPrimaryKey()
从接口复制的说明:AssociationTypeIs the primary key of the owning entity table to be used in the join?
-
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
-
isAlwaysDirtyChecked
public boolean isAlwaysDirtyChecked()
We don't need to dirty check one-to-one because of how assemble/disassemble is implemented and because a one-to-one association is never dirty
-
-