类 PersistentIdentifierBag
- java.lang.Object
-
- org.hibernate.collection.internal.AbstractPersistentCollection
-
- org.hibernate.collection.internal.PersistentIdentifierBag
-
- 所有已实现的接口:
Serializable,Iterable,Collection,List,PersistentCollection
public class PersistentIdentifierBag extends AbstractPersistentCollection implements List
An IdentifierBag implements "bag" semantics more efficiently than a regular Bag by adding a synthetic identifier column to the table. This identifier is unique for all rows in the table, allowing very efficient updates and deletes. The value of the identifier is never exposed to the application.
IdentifierBags may not be used for a many-to-one association. Furthermore, there is no reason to use inverse="true".- 作者:
- Gavin King
- 另请参阅:
- 序列化表格
-
-
嵌套类概要
-
从类继承的嵌套类/接口 org.hibernate.collection.internal.AbstractPersistentCollection
AbstractPersistentCollection.AbstractValueDelayedOperation, AbstractPersistentCollection.DelayedOperation, AbstractPersistentCollection.IteratorProxy, AbstractPersistentCollection.LazyInitializationWork<T>, AbstractPersistentCollection.ListIteratorProxy, AbstractPersistentCollection.ListProxy, AbstractPersistentCollection.SetProxy, AbstractPersistentCollection.ValueDelayedOperation
-
-
字段概要
字段 修饰符和类型 字段 说明 protected Map<Integer,Object>identifiersprotected List<Object>values-
从类继承的字段 org.hibernate.collection.internal.AbstractPersistentCollection
elementRemoved, UNKNOWN
-
-
构造器概要
构造器 构造器 说明 PersistentIdentifierBag()Constructs a PersistentIdentifierBag.PersistentIdentifierBag(SessionImplementor session)已过时。PersistentIdentifierBag(SharedSessionContractImplementor)should be used instead.PersistentIdentifierBag(SessionImplementor session, Collection coll)已过时。PersistentIdentifierBag(SharedSessionContractImplementor, Collection)should be used instead.PersistentIdentifierBag(SharedSessionContractImplementor session)Constructs a PersistentIdentifierBag.PersistentIdentifierBag(SharedSessionContractImplementor session, Collection coll)Constructs a PersistentIdentifierBag.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidadd(int index, Object element)booleanadd(Object o)booleanaddAll(int index, Collection c)booleanaddAll(Collection c)voidafterRowInsert(CollectionPersister persister, Object entry, int i)Called after inserting a row, to fetch the natively generated idvoidbeforeInitialize(CollectionPersister persister, int anticipatedSize)Called before any elements are read into the collection, allowing appropriate initializations to occur.voidclear()booleancontains(Object o)booleancontainsAll(Collection c)Serializabledisassemble(CollectionPersister persister)Disassemble the collection to get it ready for the cachebooleanempty()Is the collection empty?Iteratorentries(CollectionPersister persister)Iterate all collection entries, during update of the databasebooleanentryExists(Object entry, int i)Does the given element/entry exist in the collection?booleanequalsSnapshot(CollectionPersister persister)Does the current state exactly match the snapshot?Objectget(int index)IteratorgetDeletes(CollectionPersister persister, boolean indexIsFormula)Get all the elements that need deletingObjectgetElement(Object entry)Get the value of the given collection entry.ObjectgetIdentifier(Object entry, int i)Get the identifier of the given collection entry.ObjectgetIndex(Object entry, int i, CollectionPersister persister)Get the index of the given collection entryCollectiongetOrphans(Serializable snapshot, String entityName)get all "orphaned" elementsSerializablegetSnapshot(CollectionPersister persister)Return a new snapshot of the current state of the collectionObjectgetSnapshotElement(Object entry, int i)Get the snapshot value of the given collection entryintindexOf(Object o)voidinitializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner)Read the state of the collection from a disassembled cached valuebooleanisDirectlyProvidedCollection(Object collection)Wascollectionprovided directly to this PersistentCollection (i.e., provided as an argument to a constructor)?booleanisEmpty()booleanisSnapshotEmpty(Serializable snapshot)Is the snapshot empty?booleanisWrapper(Object collection)Is this the wrapper for the given collection instance?Iteratoriterator()intlastIndexOf(Object o)ListIteratorlistIterator()ListIteratorlistIterator(int index)booleanneedsInserting(Object entry, int i, Type elemType)Do we need to insert this element?booleanneedsUpdating(Object entry, int i, Type elemType)Do we need to update this element?voidpreInsert(CollectionPersister persister)Called before inserting rows, to ensure that any surrogate keys are fully generatedObjectreadFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)Read a row from the JDBC result setObjectremove(int index)booleanremove(Object o)booleanremoveAll(Collection c)booleanretainAll(Collection c)Objectset(int index, Object element)intsize()ListsubList(int fromIndex, int toIndex)Object[]toArray()Object[]toArray(Object[] a)-
从类继承的方法 org.hibernate.collection.internal.AbstractPersistentCollection
afterInitialize, beginRead, clearDirty, clearOperationQueue, dirty, endRead, forceInitialization, getCachedSize, getKey, getOrphans, getOwner, getQueuedOrphans, getRole, getSession, getSnapshot, getStoredSnapshot, getValue, hasQueuedOperations, identityRemove, identityRemove, initialize, isClearQueueEnabled, isConnectedToSession, isDirectlyAccessible, isDirty, isElementRemoved, isInitialized, isInverseCollection, isInverseCollectionNoOrphanDelete, isInverseOneToManyOrNoOrphanDelete, isOperationQueueEnabled, isPutQueueEnabled, isRowUpdatePossible, isUnreferenced, needsRecreate, performQueuedOperations, postAction, prepareForPossibleLoadingOutsideTransaction, queuedAdditionIterator, queueOperation, read, readElementByIndex, readElementExistence, readIndexExistence, readSize, replaceQueuedOperationValues, setCurrentSession, setDirectlyAccessible, setInitialized, setOwner, setSnapshot, unsetSession, wasInitialized, write
-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
从接口继承的方法 java.util.Collection
parallelStream, removeIf, stream, toArray
-
从接口继承的方法 java.util.List
equals, hashCode, replaceAll, sort, spliterator
-
-
-
-
构造器详细资料
-
PersistentIdentifierBag
public PersistentIdentifierBag()
Constructs a PersistentIdentifierBag. This form needed for SOAP libraries, etc
-
PersistentIdentifierBag
public PersistentIdentifierBag(SharedSessionContractImplementor session)
Constructs a PersistentIdentifierBag.- 参数:
session- The session
-
PersistentIdentifierBag
@Deprecated public PersistentIdentifierBag(SessionImplementor session)
已过时。PersistentIdentifierBag(SharedSessionContractImplementor)should be used instead.Constructs a PersistentIdentifierBag.- 参数:
session- The session
-
PersistentIdentifierBag
public PersistentIdentifierBag(SharedSessionContractImplementor session, Collection coll)
Constructs a PersistentIdentifierBag.- 参数:
session- The sessioncoll- The base elements
-
PersistentIdentifierBag
@Deprecated public PersistentIdentifierBag(SessionImplementor session, Collection coll)
已过时。PersistentIdentifierBag(SharedSessionContractImplementor, Collection)should be used instead.Constructs a PersistentIdentifierBag.- 参数:
session- The sessioncoll- The base elements
-
-
方法详细资料
-
initializeFromCache
public void initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner) throws HibernateException
从接口复制的说明:PersistentCollectionRead the state of the collection from a disassembled cached value- 指定者:
initializeFromCache在接口中PersistentCollection- 参数:
persister- The collection persisterdisassembled- The disassembled cached stateowner- The collection owner- 抛出:
HibernateException
-
getIdentifier
public Object getIdentifier(Object entry, int i)
从接口复制的说明:PersistentCollectionGet the identifier of the given collection entry. This refers to the collection identifier, not the identifier of the (possibly) entity elements. This is only valid for invocation on theidbagcollection.- 指定者:
getIdentifier在接口中PersistentCollection- 覆盖:
getIdentifier在类中AbstractPersistentCollection- 参数:
entry- The collection entry/elementi- The assumed identifier (?)- 返回:
- The identifier value
-
isWrapper
public boolean isWrapper(Object collection)
从接口复制的说明:PersistentCollectionIs this the wrapper for the given collection instance?- 指定者:
isWrapper在接口中PersistentCollection- 参数:
collection- The collection to check whether this is wrapping it- 返回:
trueif this is a wrapper around that given collection instance.
-
isDirectlyProvidedCollection
public boolean isDirectlyProvidedCollection(Object collection)
从接口复制的说明:PersistentCollectionWascollectionprovided directly to this PersistentCollection (i.e., provided as an argument to a constructor)? Implementors that can copy elements out of a directly provided collection into the wrapped collection should override this method.- 指定者:
isDirectlyProvidedCollection在接口中PersistentCollection- 参数:
collection- The collection- 返回:
- true, if
collectionwas provided directly to this PersistentCollection; false, otherwise.
-
add
public boolean add(Object o)
- 指定者:
add在接口中Collection- 指定者:
add在接口中List
-
clear
public void clear()
- 指定者:
clear在接口中Collection- 指定者:
clear在接口中List
-
contains
public boolean contains(Object o)
- 指定者:
contains在接口中Collection- 指定者:
contains在接口中List
-
containsAll
public boolean containsAll(Collection c)
- 指定者:
containsAll在接口中Collection- 指定者:
containsAll在接口中List
-
isEmpty
public boolean isEmpty()
- 指定者:
isEmpty在接口中Collection- 指定者:
isEmpty在接口中List
-
iterator
public Iterator iterator()
-
remove
public boolean remove(Object o)
- 指定者:
remove在接口中Collection- 指定者:
remove在接口中List
-
removeAll
public boolean removeAll(Collection c)
- 指定者:
removeAll在接口中Collection- 指定者:
removeAll在接口中List
-
retainAll
public boolean retainAll(Collection c)
- 指定者:
retainAll在接口中Collection- 指定者:
retainAll在接口中List
-
size
public int size()
- 指定者:
size在接口中Collection- 指定者:
size在接口中List
-
toArray
public Object[] toArray()
- 指定者:
toArray在接口中Collection- 指定者:
toArray在接口中List
-
beforeInitialize
public void beforeInitialize(CollectionPersister persister, int anticipatedSize)
从接口复制的说明:PersistentCollectionCalled before any elements are read into the collection, allowing appropriate initializations to occur.- 指定者:
beforeInitialize在接口中PersistentCollection- 参数:
persister- The underlying collection persister.anticipatedSize- The anticipated size of the collection after initialization is complete.
-
disassemble
public Serializable disassemble(CollectionPersister persister) throws HibernateException
从接口复制的说明:PersistentCollectionDisassemble the collection to get it ready for the cache- 指定者:
disassemble在接口中PersistentCollection- 参数:
persister- The collection persister- 返回:
- The disassembled state
- 抛出:
HibernateException
-
empty
public boolean empty()
从接口复制的说明:PersistentCollectionIs the collection empty? (don't try to initialize the collection)- 指定者:
empty在接口中PersistentCollection- 指定者:
empty在类中AbstractPersistentCollection- 返回:
falseif the collection is non-empty;trueotherwise.
-
entries
public Iterator entries(CollectionPersister persister)
从接口复制的说明:PersistentCollectionIterate all collection entries, during update of the database- 指定者:
entries在接口中PersistentCollection- 参数:
persister- The collection persister.- 返回:
- The iterator
-
entryExists
public boolean entryExists(Object entry, int i)
从接口复制的说明:PersistentCollectionDoes the given element/entry exist in the collection?- 指定者:
entryExists在接口中PersistentCollection- 参数:
entry- The object to check if it exists as a collection elementi- Unused- 返回:
trueif the given entry is a collection element
-
equalsSnapshot
public boolean equalsSnapshot(CollectionPersister persister) throws HibernateException
从接口复制的说明:PersistentCollectionDoes the current state exactly match the snapshot?- 指定者:
equalsSnapshot在接口中PersistentCollection- 参数:
persister- The collection persister- 返回:
trueif the current state and the snapshot state match.- 抛出:
HibernateException
-
isSnapshotEmpty
public boolean isSnapshotEmpty(Serializable snapshot)
从接口复制的说明:PersistentCollectionIs the snapshot empty?- 指定者:
isSnapshotEmpty在接口中PersistentCollection- 参数:
snapshot- The snapshot to check- 返回:
trueif the given snapshot is empty
-
getDeletes
public Iterator getDeletes(CollectionPersister persister, boolean indexIsFormula) throws HibernateException
从接口复制的说明:PersistentCollectionGet all the elements that need deleting- 指定者:
getDeletes在接口中PersistentCollection- 参数:
persister- The collection persisterindexIsFormula- For indexed collections, tells whether the index is a formula (calculated value) mapping- 返回:
- An iterator over the elements to delete
- 抛出:
HibernateException
-
getIndex
public Object getIndex(Object entry, int i, CollectionPersister persister)
从接口复制的说明:PersistentCollectionGet the index of the given collection entry- 指定者:
getIndex在接口中PersistentCollection- 参数:
entry- The collection entry/elementi- The assumed indexpersister- it was more elegant before we added this...- 返回:
- The index value
-
getElement
public Object getElement(Object entry)
从接口复制的说明:PersistentCollectionGet the value of the given collection entry. Generally the given entry parameter value will just be returned. Might get a different value for a duplicate entries in a Set.- 指定者:
getElement在接口中PersistentCollection- 参数:
entry- The object instance for which to get the collection element instance.- 返回:
- The corresponding object that is part of the collection elements.
-
getSnapshotElement
public Object getSnapshotElement(Object entry, int i)
从接口复制的说明:PersistentCollectionGet the snapshot value of the given collection entry- 指定者:
getSnapshotElement在接口中PersistentCollection- 参数:
entry- The entryi- The index- 返回:
- The snapshot state for that element
-
needsInserting
public boolean needsInserting(Object entry, int i, Type elemType) throws HibernateException
从接口复制的说明:PersistentCollectionDo we need to insert this element?- 指定者:
needsInserting在接口中PersistentCollection- 参数:
entry- The collection element to checki- The index (for indexed collections)elemType- The type for the element- 返回:
trueif the element needs inserting- 抛出:
HibernateException
-
needsUpdating
public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException
从接口复制的说明:PersistentCollectionDo we need to update this element?- 指定者:
needsUpdating在接口中PersistentCollection- 参数:
entry- The collection element to checki- The index (for indexed collections)elemType- The type for the element- 返回:
trueif the element needs updating- 抛出:
HibernateException
-
readFrom
public Object readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner) throws HibernateException, SQLException
从接口复制的说明:PersistentCollectionRead a row from the JDBC result set- 指定者:
readFrom在接口中PersistentCollection- 参数:
rs- The JDBC ResultSetpersister- The collection roledescriptor- The aliases used for the columns making up the collectionowner- The collection owner- 返回:
- The read object
- 抛出:
HibernateException- Generally indicates a problem resolving data read from the ResultSetSQLException- Indicates a problem accessing the ResultSet
-
getSnapshot
public Serializable getSnapshot(CollectionPersister persister) throws HibernateException
从接口复制的说明:PersistentCollectionReturn a new snapshot of the current state of the collection- 指定者:
getSnapshot在接口中PersistentCollection- 参数:
persister- The collection persister- 返回:
- The snapshot
- 抛出:
HibernateException
-
getOrphans
public Collection getOrphans(Serializable snapshot, String entityName) throws HibernateException
从接口复制的说明:PersistentCollectionget all "orphaned" elements- 指定者:
getOrphans在接口中PersistentCollection- 指定者:
getOrphans在类中AbstractPersistentCollection- 参数:
snapshot- The snapshot stateentityName- The name of the entity that are the elements of the collection- 返回:
- The orphans
- 抛出:
HibernateException
-
preInsert
public void preInsert(CollectionPersister persister) throws HibernateException
从接口复制的说明:PersistentCollectionCalled before inserting rows, to ensure that any surrogate keys are fully generated- 指定者:
preInsert在接口中PersistentCollection- 覆盖:
preInsert在类中AbstractPersistentCollection- 参数:
persister- The collection persister- 抛出:
HibernateException
-
addAll
public boolean addAll(int index, Collection c)
-
lastIndexOf
public int lastIndexOf(Object o)
- 指定者:
lastIndexOf在接口中List
-
listIterator
public ListIterator listIterator()
- 指定者:
listIterator在接口中List
-
listIterator
public ListIterator listIterator(int index)
- 指定者:
listIterator在接口中List
-
addAll
public boolean addAll(Collection c)
- 指定者:
addAll在接口中Collection- 指定者:
addAll在接口中List
-
afterRowInsert
public void afterRowInsert(CollectionPersister persister, Object entry, int i) throws HibernateException
从接口复制的说明:PersistentCollectionCalled after inserting a row, to fetch the natively generated id- 指定者:
afterRowInsert在接口中PersistentCollection- 覆盖:
afterRowInsert在类中AbstractPersistentCollection- 参数:
persister- The collection persisterentry- The collection element just insertedi- The element position/index- 抛出:
HibernateException
-
-