类 CollectionType
- java.lang.Object
-
- org.hibernate.type.AbstractType
-
- org.hibernate.type.CollectionType
-
- 所有已实现的接口:
Serializable,AssociationType,Type
- 直接已知子类:
ArrayType,BagType,CustomCollectionType,IdentifierBagType,ListType,MapType,SetType
public abstract class CollectionType extends AbstractType implements AssociationType
A type that handles Hibernate PersistentCollections (including arrays).- 作者:
- Gavin King
- 另请参阅:
- 序列化表格
-
-
字段概要
字段 修饰符和类型 字段 说明 static ObjectUNFETCHED_COLLECTION-
从类继承的字段 org.hibernate.type.AbstractType
LEGACY_DEFAULT_SIZE, LEGACY_DICTATED_SIZE
-
-
构造器概要
构造器 构造器 说明 CollectionType(String role, String foreignKeyPropertyName)CollectionType(TypeFactory.TypeScope typeScope, String role, String foreignKeyPropertyName)已过时。Use the other constructor
-
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 Objectassemble(Serializable cached, SharedSessionContractImplementor session, Object owner)Reconstruct the object from its disassembled state.intcompare(Object x, Object y)Perform aComparatorstyle comparison between valuesbooleancontains(Object collection, Object childObject, SharedSessionContractImplementor session)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.Serializabledisassemble(Object value, SharedSessionContractImplementor session, Object owner)Return a disassembled representation of the object.StringgetAssociatedEntityName(SessionFactoryImplementor factory)Get the entity name of the associated entityJoinablegetAssociatedJoinable(SessionFactoryImplementor factory)Get the "persister" for this association - a class or collection persisterObjectgetCollection(Serializable key, SharedSessionContractImplementor session, Object owner, Boolean overridingEager)instantiate a collection wrapper (called when loading an object)intgetColumnSpan(Mapping session)How many columns are used to persist this type.protected IteratorgetElementsIterator(Object collection)Get an iterator over the element set of the collection in POJO modeIteratorgetElementsIterator(Object collection, SharedSessionContractImplementor session)Get an iterator over the element set of the collection, which may not yet be wrappedTypegetElementType(SessionFactoryImplementor factory)Get the Hibernate type of the collection elementsForeignKeyDirectiongetForeignKeyDirection()Get the foreign key directionality of this associationintgetHashCode(Object x)Get a hash code, consistent with persistence "equality".SerializablegetIdOfOwnerOrNull(Serializable key, SharedSessionContractImplementor session)Get the id value from the owning entity key, usually the same as the key, but might be some other property, in the case of property-refSerializablegetKeyOfOwner(Object owner, SharedSessionContractImplementor session)Get the key value from the owning entity instance, usually the identifier, but might be some other unique key, in the case of property-refStringgetLHSPropertyName()Get the name of a property in the owning entity that provides the join key (null if the identifier)StringgetName()Returns the abbreviated name of the type.StringgetOnCondition(String alias, SessionFactoryImplementor factory, Map enabledFilters)Get the "filtering" SQL fragment that is applied in the SQL on clause, in addition to the usual join conditionStringgetOnCondition(String alias, SessionFactoryImplementor factory, Map enabledFilters, Set<String> treatAsDeclarations)Get the "filtering" SQL fragment that is applied in the SQL on clause, in addition to the usual join conditionStringgetRHSUniqueKeyPropertyName()The name of a unique property of the associated entity that provides the join key (null if the identifier of an entity, or key of a collection)StringgetRole()booleanhasHolder()Objecthydrate(ResultSet rs, String[] name, SharedSessionContractImplementor session, Object owner)Extract a value from the JDBC result set.ObjectindexOf(Object collection, Object element)protected booleaninitializeImmediately()abstract Objectinstantiate(int anticipatedSize)Instantiate an empty instance of the "underlying" collection (not a wrapper), but with the given anticipated size (i.e. accounting for initial capacity and perhaps load factor).abstract PersistentCollectioninstantiate(SharedSessionContractImplementor session, CollectionPersister persister, Serializable key)Instantiate an uninitialized collection wrapper or holder.protected ObjectinstantiateResult(Object original)Instantiate a new "underlying" collection exhibiting the same capacity characteristics and the passed "original".booleanisAlwaysDirtyChecked()We always need to dirty check the collection because we sometimes need to increment version number of owner and also because of how assemble/disassemble is implemented for uksbooleanisArrayType()booleanisAssociationType()Note: return true because this type is castable to AssociationType.booleanisCollectionType()Return true if the implementation is castable toCollectionType.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?booleanisEqual(Object x, Object y)Compare two instances of the class mapped by this type for persistence "equality" (equality of persistent state).booleanisModified(Object old, Object current, boolean[] checkable, SharedSessionContractImplementor session)Has the value been modified compared to the current database state?booleanisMutable()Are objects of this type mutable.ObjectnullSafeGet(ResultSet rs, String[] name, 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.protected StringrenderLoggableString(Object value, SessionFactoryImplementor factory)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.ObjectreplaceElements(Object original, Object target, Object owner, Map copyCache, SharedSessionContractImplementor session)Replace the elements of a collection with the elements of another collection.Objectresolve(Object value, SharedSessionContractImplementor session, Object owner)Objectresolve(Object value, SharedSessionContractImplementor session, Object owner, Boolean overridingEager)The second phase of 2-phase loading.ObjectsemiResolve(Object value, SharedSessionContractImplementor session, Object owner)Given a hydrated, but unresolved value, return a value that may be used to reconstruct property-ref associations.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.StringtoLoggableString(Object value, SessionFactoryImplementor factory)Generate a representation of the value for logging purposes.StringtoString()booleanuseLHSPrimaryKey()Is the primary key of the owning entity table to be used in the join?abstract PersistentCollectionwrap(SharedSessionContractImplementor session, Object collection)Wrap the naked collection instance in a wrapper, or instantiate a holder.-
从类继承的方法 org.hibernate.type.AbstractType
beforeAssemble, getHashCode, getSemiResolvedType, isAnyType, isComponentType, isEntityType, isEqual, isSame, replace
-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
从接口继承的方法 org.hibernate.type.Type
beforeAssemble, getHashCode, getReturnedClass, getSemiResolvedType, isAnyType, isComponentType, isEntityType, isEqual, isSame, replace
-
-
-
-
字段详细资料
-
UNFETCHED_COLLECTION
public static final Object UNFETCHED_COLLECTION
-
-
构造器详细资料
-
CollectionType
@Deprecated public CollectionType(TypeFactory.TypeScope typeScope, String role, String foreignKeyPropertyName)
已过时。Use the other constructor
-
-
方法详细资料
-
getRole
public String getRole()
-
contains
public boolean contains(Object collection, Object childObject, SharedSessionContractImplementor session)
-
isCollectionType
public boolean isCollectionType()
从接口复制的说明:TypeReturn true if the implementation is castable toCollectionType. Essentially a polymorphic version of(type instanceof CollectionType.class)ACollectionTypeis additionally anAssociationType; so if this method returns true,Type.isAssociationType()should also return true.- 指定者:
isCollectionType在接口中Type- 覆盖:
isCollectionType在类中AbstractType- 返回:
- True if this type is also a
CollectionTypeimplementor; false otherwise.
-
isEqual
public final boolean isEqual(Object x, Object y)
从接口复制的说明:TypeCompare two instances of the class mapped by this type for persistence "equality" (equality of persistent state). This should always equate to some form of comparison of the value's internal state. As an example, for something like a date the comparison should be based on its internal "time" state based on the specific portion it is meant to represent (timestamp, date, time).- 指定者:
isEqual在接口中Type- 覆盖:
isEqual在类中AbstractType- 参数:
x- The first valuey- The second value- 返回:
- True if there are considered equal (see discussion above).
-
compare
public int compare(Object x, Object y)
从接口复制的说明:TypePerform aComparatorstyle comparison between values- 指定者:
compare在接口中Type- 覆盖:
compare在类中AbstractType- 参数:
x- The first valuey- The second value- 返回:
- The comparison result. See
Comparator.compare(T, T)for a discussion.
-
getHashCode
public int getHashCode(Object x)
从接口复制的说明:TypeGet a hash code, consistent with persistence "equality". Again for most types the normal usage is to delegate to the value'shashCode.- 指定者:
getHashCode在接口中Type- 覆盖:
getHashCode在类中AbstractType- 参数:
x- The value for which to retrieve a hash code- 返回:
- The hash code
-
instantiate
public abstract PersistentCollection instantiate(SharedSessionContractImplementor session, CollectionPersister persister, Serializable key)
Instantiate an uninitialized collection wrapper or holder. Callers MUST add the holder to the persistence context!- 参数:
session- The session from which the request is originating.persister- The underlying collection persister (metadata)key- The owner key.- 返回:
- The instantiated collection.
-
nullSafeGet
public Object nullSafeGet(ResultSet rs, String name, SharedSessionContractImplementor session, Object owner) throws 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.- 指定者:
nullSafeGet在接口中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
- 抛出:
SQLException- An error from the JDBC driver
-
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.- 指定者:
nullSafeGet在接口中Type- 参数:
rs- The result set from which to extract value.name- 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
-
nullSafeSet
public final 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.- 指定者:
nullSafeSet在接口中Type- 参数:
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.- 指定者:
nullSafeSet在接口中Type- 参数:
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
-
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).- 指定者:
sqlTypes在接口中Type- 参数:
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).- 指定者:
dictatedSizes在接口中Type- 参数:
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).- 指定者:
defaultSizes在接口中Type- 参数:
mapping- The mapping object :/- 返回:
- The default sizes.
- 抛出:
MappingException- Generally indicates an issue accessing the passed mapping object.
-
getColumnSpan
public int getColumnSpan(Mapping session) throws MappingException
从接口复制的说明:TypeHow many columns are used to persist this type. Always the same assqlTypes(mapping).length- 指定者:
getColumnSpan在接口中Type- 参数:
session- The mapping object :/- 返回:
- The number of columns
- 抛出:
MappingException- Generally indicates an issue accessing the passed mapping object.
-
toLoggableString
public String toLoggableString(Object value, SessionFactoryImplementor factory) throws HibernateException
从接口复制的说明:TypeGenerate a representation of the value for logging purposes.- 指定者:
toLoggableString在接口中Type- 参数:
value- The value to be loggedfactory- The session factory- 返回:
- The loggable representation
- 抛出:
HibernateException- An error from Hibernate
-
renderLoggableString
protected String renderLoggableString(Object value, SessionFactoryImplementor factory) throws HibernateException
-
deepCopy
public Object deepCopy(Object value, SessionFactoryImplementor factory) throws HibernateException
从接口复制的说明:TypeReturn a deep copy of the persistent state, stopping at entities and at collections.- 指定者:
deepCopy在接口中Type- 参数:
value- The value to be copiedfactory- The session factory- 返回:
- The deep copy
- 抛出:
HibernateException- An error from Hibernate
-
getElementsIterator
public Iterator getElementsIterator(Object collection, SharedSessionContractImplementor session)
Get an iterator over the element set of the collection, which may not yet be wrapped- 参数:
collection- The collection to be iteratedsession- The session from which the request is originating.- 返回:
- The iterator.
-
getElementsIterator
protected Iterator getElementsIterator(Object collection)
Get an iterator over the element set of the collection in POJO mode- 参数:
collection- The collection to be iterated- 返回:
- The iterator.
-
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.)
-
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 cached, 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- 参数:
cached- the disassembled state from the cachesession- the originating sessionowner- the parent entity object- 返回:
- the (re)assembled object
- 抛出:
HibernateException- An error from Hibernate
-
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?- 指定者:
isDirty在接口中Type- 参数:
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
-
wrap
public abstract PersistentCollection wrap(SharedSessionContractImplementor session, Object collection)
Wrap the naked collection instance in a wrapper, or instantiate a holder. Callers MUST add the holder to the persistence context!- 参数:
session- The session from which the request is originating.collection- The bare collection to be wrapped.- 返回:
- The wrapped collection.
-
isAssociationType
public boolean isAssociationType()
Note: return true because this type is castable to AssociationType. Not because all collections are associations.- 指定者:
isAssociationType在接口中Type- 覆盖:
isAssociationType在类中AbstractType- 返回:
- True if this type is also an
AssociationTypeimplementor; false otherwise.
-
getForeignKeyDirection
public ForeignKeyDirection getForeignKeyDirection()
从接口复制的说明:AssociationTypeGet the foreign key directionality of this association- 指定者:
getForeignKeyDirection在接口中AssociationType
-
getKeyOfOwner
public Serializable getKeyOfOwner(Object owner, SharedSessionContractImplementor session)
Get the key value from the owning entity instance, usually the identifier, but might be some other unique key, in the case of property-ref- 参数:
owner- The collection ownersession- The session from which the request is originating.- 返回:
- The collection owner's key
-
getIdOfOwnerOrNull
public Serializable getIdOfOwnerOrNull(Serializable key, SharedSessionContractImplementor session)
Get the id value from the owning entity key, usually the same as the key, but might be some other property, in the case of property-ref- 参数:
key- The collection owner keysession- The session from which the request is originating.- 返回:
- The collection owner's id, if it can be obtained from the key; otherwise, null is returned
-
hydrate
public Object hydrate(ResultSet rs, String[] name, SharedSessionContractImplementor session, Object owner)
从接口复制的说明: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 setname- 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.
- 另请参阅:
Type.resolve(java.lang.Object, org.hibernate.engine.spi.SharedSessionContractImplementor, java.lang.Object)
-
resolve
public Object resolve(Object value, SharedSessionContractImplementor session, Object owner) throws HibernateException
- 指定者:
resolve在接口中Type- 覆盖:
resolve在类中AbstractType- 抛出:
HibernateException- 另请参阅:
Type.resolve(Object, SharedSessionContractImplementor, Object, Boolean)
-
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- 参数:
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)
-
semiResolve
public Object semiResolve(Object value, SharedSessionContractImplementor session, Object owner) throws HibernateException
从接口复制的说明:TypeGiven a hydrated, but unresolved value, return a value that may be used to reconstruct property-ref associations.- 指定者:
semiResolve在接口中Type- 覆盖:
semiResolve在类中AbstractType- 参数:
value- The unresolved, hydrated valuesession- THe originating sessionowner- The value owner- 返回:
- The semi-resolved value
- 抛出:
HibernateException- An error from Hibernate
-
isArrayType
public boolean isArrayType()
-
useLHSPrimaryKey
public boolean useLHSPrimaryKey()
从接口复制的说明:AssociationTypeIs the primary key of the owning entity table to be used in the join?- 指定者:
useLHSPrimaryKey在接口中AssociationType
-
getRHSUniqueKeyPropertyName
public String getRHSUniqueKeyPropertyName()
从接口复制的说明:AssociationTypeThe name of a unique property of the associated entity that provides the join key (null if the identifier of an entity, or key of a collection)- 指定者:
getRHSUniqueKeyPropertyName在接口中AssociationType
-
getAssociatedJoinable
public Joinable getAssociatedJoinable(SessionFactoryImplementor factory) throws MappingException
从接口复制的说明:AssociationTypeGet the "persister" for this association - a class or collection persister- 指定者:
getAssociatedJoinable在接口中AssociationType- 抛出:
MappingException
-
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
-
getAssociatedEntityName
public String getAssociatedEntityName(SessionFactoryImplementor factory) throws MappingException
从接口复制的说明:AssociationTypeGet the entity name of the associated entity- 指定者:
getAssociatedEntityName在接口中AssociationType- 抛出:
MappingException
-
replaceElements
public Object replaceElements(Object original, Object target, Object owner, Map copyCache, SharedSessionContractImplementor session)
Replace the elements of a collection with the elements of another collection.- 参数:
original- The 'source' of the replacement elements (where we copy from)target- The target of the replacement elements (where we copy to)owner- The owner of the collection being mergedcopyCache- The map of elements already replaced.session- The session from which the merge event originated.- 返回:
- The merged collection.
-
instantiateResult
protected Object instantiateResult(Object original)
Instantiate a new "underlying" collection exhibiting the same capacity characteristics and the passed "original".- 参数:
original- The original collection.- 返回:
- The newly instantiated collection.
-
instantiate
public abstract Object instantiate(int anticipatedSize)
Instantiate an empty instance of the "underlying" collection (not a wrapper), but with the given anticipated size (i.e. accounting for initial capacity and perhaps load factor).- 参数:
anticipatedSize- The anticipated size of the instantiated collection after we are done populating it.- 返回:
- A newly instantiated collection to be wrapped.
-
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.- 指定者:
replace在接口中Type- 参数:
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
-
getElementType
public final Type getElementType(SessionFactoryImplementor factory) throws MappingException
Get the Hibernate type of the collection elements- 参数:
factory- The session factory.- 返回:
- The type of the collection elements
- 抛出:
MappingException- Indicates the underlying persister could not be located.
-
getOnCondition
public String getOnCondition(String alias, SessionFactoryImplementor factory, Map enabledFilters) throws MappingException
从接口复制的说明:AssociationTypeGet the "filtering" SQL fragment that is applied in the SQL on clause, in addition to the usual join condition- 指定者:
getOnCondition在接口中AssociationType- 抛出:
MappingException
-
getOnCondition
public String getOnCondition(String alias, SessionFactoryImplementor factory, Map enabledFilters, Set<String> treatAsDeclarations)
从接口复制的说明:AssociationTypeGet the "filtering" SQL fragment that is applied in the SQL on clause, in addition to the usual join condition- 指定者:
getOnCondition在接口中AssociationType
-
getCollection
public Object getCollection(Serializable key, SharedSessionContractImplementor session, Object owner, Boolean overridingEager)
instantiate a collection wrapper (called when loading an object)- 参数:
key- The collection owner keysession- The session from which the request is originating.owner- The collection owner- 返回:
- The collection
-
hasHolder
public boolean hasHolder()
-
initializeImmediately
protected boolean initializeImmediately()
-
getLHSPropertyName
public String getLHSPropertyName()
从接口复制的说明:AssociationTypeGet the name of a property in the owning entity that provides the join key (null if the identifier)- 指定者:
getLHSPropertyName在接口中AssociationType
-
isAlwaysDirtyChecked
public boolean isAlwaysDirtyChecked()
We always need to dirty check the collection because we sometimes need to increment version number of owner and also because of how assemble/disassemble is implemented for uks- 指定者:
isAlwaysDirtyChecked在接口中AssociationType
-
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.- 指定者:
toColumnNullness在接口中Type- 参数:
value- an instance of the typemapping- The mapping abstraction- 返回:
- array indicating column nullness for a value instance
-
-