类 DiscriminatorType
- java.lang.Object
-
- org.hibernate.type.AbstractType
-
- org.hibernate.persister.entity.DiscriminatorType
-
- 所有已实现的接口:
Serializable,Type
public class DiscriminatorType extends AbstractType
TODO : javadoc- 作者:
- Steve Ebersole
- 另请参阅:
- 序列化表格
-
-
字段概要
-
从类继承的字段 org.hibernate.type.AbstractType
LEGACY_DEFAULT_SIZE, LEGACY_DICTATED_SIZE
-
-
构造器概要
构造器 构造器 说明 DiscriminatorType(Type underlyingType, Loadable persister)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 ObjectdeepCopy(Object value, SessionFactoryImplementor factory)Return a deep copy of the persistent state, stopping at entities and at collections.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.intgetColumnSpan(Mapping mapping)How many columns are used to persist this type.StringgetName()Returns the abbreviated name of the type.ClassgetReturnedClass()booleanisDirty(Object old, Object current, boolean[] checkable, SharedSessionContractImplementor session)Should the parent be considered dirty, given both the old and current value?booleanisMutable()Are objects of this type mutable.ObjectnullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)Extract a value of themapped classfrom the JDBC result set.ObjectnullSafeGet(ResultSet rs, String name, SharedSessionContractImplementor session, Object owner)Extract a value of themapped classfrom the JDBC result set.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.voidnullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session)Bind a value represented by an instance of themapped classto the JDBC prepared statement.Objectreplace(Object original, Object target, SharedSessionContractImplementor session, Object owner, Map 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.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.StringtoLoggableString(Object value, SessionFactoryImplementor factory)Generate a representation of the value for logging purposes.-
从类继承的方法 org.hibernate.type.AbstractType
assemble, beforeAssemble, compare, disassemble, getHashCode, getHashCode, getSemiResolvedType, hydrate, isAnyType, isAssociationType, isCollectionType, isComponentType, isDirty, isEntityType, isEqual, isEqual, isModified, isSame, replace, resolve, semiResolve
-
-
-
-
方法详细资料
-
getReturnedClass
public Class getReturnedClass()
从接口复制的说明:TypeThe class returned byType.nullSafeGet(java.sql.ResultSet, java.lang.String[], org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)methods. This is used to establish the class of an array of this type.- 返回:
- The java type class handled by this type.
-
getName
public String getName()
从接口复制的说明:TypeReturns the abbreviated name of the type.- 返回:
- String the Hibernate type name
-
isMutable
public boolean isMutable()
从接口复制的说明:TypeAre objects of this type mutable. (With respect to the referencing object ... entities and collections are considered immutable because they manage their own internal state.)- 返回:
- boolean
-
nullSafeGet
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException
从接口复制的说明:TypeExtract a value of themapped classfrom the JDBC result set. Implementors should handle possibility of null values.- 参数:
rs- The result set from which to extract value.names- the column names making up this type value (use to read from result set)session- The originating sessionowner- the parent entity- 返回:
- The extracted value
- 抛出:
HibernateException- An error from HibernateSQLException- An error from the JDBC driver- 另请参阅:
alternative, 2-phase property initialization
-
nullSafeGet
public Object nullSafeGet(ResultSet rs, String name, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException
从接口复制的说明:TypeExtract a value of themapped classfrom the JDBC result set. Implementors should handle possibility of null values. This form might be called if the type is known to be a single-column type.- 参数:
rs- The result set from which to extract value.name- the column name making up this type value (use to read from result set)session- The originating sessionowner- the parent entity- 返回:
- The extracted value
- 抛出:
HibernateException- An error from HibernateSQLException- An error from the JDBC driver
-
nullSafeSet
public void nullSafeSet(PreparedStatement st, Object value, int index, boolean[] settable, SharedSessionContractImplementor session) throws HibernateException, SQLException
从接口复制的说明: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.- 参数:
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- 抛出:
HibernateException- An error from HibernateSQLException- An error from the JDBC driver
-
nullSafeSet
public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException
从接口复制的说明:TypeBind a value represented by an instance of themapped classto the JDBC prepared statement. Implementors should handle possibility of null values. A multi-column type should bind parameters starting from index.- 参数:
st- The JDBC prepared statement to which to bindvalue- the object to writeindex- starting parameter bind indexsession- The originating session- 抛出:
HibernateException- An error from HibernateSQLException- An error from the JDBC driver
-
toLoggableString
public String toLoggableString(Object value, SessionFactoryImplementor factory) throws HibernateException
从接口复制的说明:TypeGenerate a representation of the value for logging purposes.- 参数:
value- The value to be loggedfactory- The session factory- 返回:
- The loggable representation
- 抛出:
HibernateException- An error from Hibernate
-
deepCopy
public Object deepCopy(Object value, SessionFactoryImplementor factory) throws HibernateException
从接口复制的说明:TypeReturn a deep copy of the persistent state, stopping at entities and at collections.- 参数:
value- The value to be copiedfactory- The session factory- 返回:
- The deep copy
- 抛出:
HibernateException- An error from Hibernate
-
replace
public Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner, Map copyCache) throws HibernateException
从接口复制的说明:TypeDuring 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. For immutable objects, or null values, it is safe to simply return the first parameter. For mutable objects, it is safe to return a copy of the first parameter. For objects with component values, it might make sense to recursively replace component values.- 参数:
original- the value from the detached entity being mergedtarget- the value in the managed entitysession- The originating sessionowner- The owner of the valuecopyCache- The cache of already copied/replaced values- 返回:
- the value to be merged
- 抛出:
HibernateException- An error from Hibernate
-
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, 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
-
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.
-
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.
-
-