public abstract class AbstractPersistentCollection extends Object implements Serializable, PersistentCollection
PersistentCollection| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractPersistentCollection.AbstractValueDelayedOperation |
protected static interface |
AbstractPersistentCollection.DelayedOperation
Contract for operations which are part of a collection's operation queue.
|
protected class |
AbstractPersistentCollection.IteratorProxy |
static interface |
AbstractPersistentCollection.LazyInitializationWork<T>
TBH not sure why this is public
|
protected class |
AbstractPersistentCollection.ListIteratorProxy |
protected class |
AbstractPersistentCollection.ListProxy |
protected class |
AbstractPersistentCollection.SetProxy |
protected static interface |
AbstractPersistentCollection.ValueDelayedOperation |
| Modifier | Constructor and Description |
|---|---|
|
AbstractPersistentCollection()
Not called by Hibernate, but used by non-JDK serialization,
eg.
|
protected |
AbstractPersistentCollection(SessionImplementor session) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
afterInitialize()
Called after initializing from cache
|
void |
afterRowInsert(CollectionPersister persister,
Object entry,
int i)
Called after inserting a row, to fetch the natively generated id
|
void |
beginRead()
Called just before reading any rows from the JDBC result set
|
void |
clearDirty()
Clear the dirty flag, after flushing changes
to the database.
|
void |
dirty()
Mark the collection as dirty
|
abstract boolean |
empty()
Is the collection empty? (don't try to initialize the collection)
|
boolean |
endRead()
Called after reading all rows from the JDBC result set
|
void |
forceInitialization()
To be called internally by the session, forcing immediate initialization.
|
protected int |
getCachedSize() |
Object |
getIdentifier(Object entry,
int i)
Get the identifier of the given collection entry.
|
Serializable |
getKey()
Get the current collection key value
|
protected static Collection |
getOrphans(Collection oldElements,
Collection currentElements,
String entityName,
SessionImplementor session)
Given a collection of entity instances that used to
belong to the collection, and a collection of instances
that currently belong, return a collection of orphans
|
abstract Collection |
getOrphans(Serializable snapshot,
String entityName)
get all "orphaned" elements
|
Object |
getOwner()
Get the owning entity.
|
Collection |
getQueuedOrphans(String entityName)
Get the "queued" orphans
|
String |
getRole()
Get the current role name
|
SessionImplementor |
getSession()
Get the session currently associated with this collection.
|
protected Serializable |
getSnapshot()
Get the current snapshot from the session
|
Serializable |
getStoredSnapshot()
Get the snapshot cached by the collection instance
|
Object |
getValue()
Return the user-visible collection (or array) instance
|
boolean |
hasQueuedOperations()
Does this instance have any "queued" operations?
|
static void |
identityRemove(Collection list,
Object entityInstance,
String entityName,
SessionImplementor session)
Removes entity entries that have an equal identifier with the incoming entity instance
|
protected void |
initialize(boolean writing)
Initialize the collection, if possible, wrapping any exceptions
in a runtime exception
|
protected boolean |
isClearQueueEnabled()
Is this collection in a state that would allow us to
"queue" clear? This is a special case, because of orphan
delete.
|
protected boolean |
isConnectedToSession() |
boolean |
isDirectlyAccessible()
Could the application possibly have a direct reference to
the underlying collection implementation?
|
boolean |
isDirty()
Is the collection dirty? Note that this is only
reliable during the flush cycle, after the
collection elements are dirty checked against
the snapshot.
|
protected boolean |
isInitialized() |
protected boolean |
isInverseCollection()
Is this the "inverse" end of a bidirectional association?
|
protected boolean |
isInverseCollectionNoOrphanDelete()
Is this the "inverse" end of a bidirectional association with
no orphan delete enabled?
|
protected boolean |
isInverseOneToManyOrNoOrphanDelete()
Is this the "inverse" end of a bidirectional one-to-many, or
of a collection with no orphan delete?
|
protected boolean |
isOperationQueueEnabled()
Is this collection in a state that would allow us to
"queue" operations?
|
protected boolean |
isPutQueueEnabled()
Is this collection in a state that would allow us to
"queue" puts? This is a special case, because of orphan
delete.
|
boolean |
isRowUpdatePossible()
Can each element in the collection be mapped unequivocally to a single row in the database? Generally
bags and sets are the only collections that cannot be.
|
boolean |
isUnreferenced()
Is the collection unreferenced?
|
boolean |
needsRecreate(CollectionPersister persister)
Do we need to completely recreate this collection when it changes?
|
protected void |
performQueuedOperations()
After reading all existing elements from the database,
add the queued elements to the underlying collection.
|
void |
postAction()
After flushing, clear any "queued" additions, since the
database state is now synchronized with the memory state.
|
void |
preInsert(CollectionPersister persister)
Called before inserting rows, to ensure that any surrogate keys
are fully generated
|
protected void |
prepareForPossibleLoadingOutsideTransaction() |
Iterator |
queuedAdditionIterator()
Iterator over the "queued" additions
|
protected void |
queueOperation(AbstractPersistentCollection.DelayedOperation operation)
Queue an addition
|
protected void |
read()
Called by any read-only method of the collection interface
|
protected Object |
readElementByIndex(Object index) |
protected Boolean |
readElementExistence(Object element) |
protected Boolean |
readIndexExistence(Object index) |
protected boolean |
readSize()
Called by the
Collection.size() method |
void |
replaceQueuedOperationValues(CollectionPersister persister,
Map copyCache)
Replace entity instances with copy in
copyCache/. |
boolean |
setCurrentSession(SessionImplementor session)
Associate the collection with the given session.
|
protected void |
setDirectlyAccessible(boolean directlyAccessible) |
protected void |
setInitialized() |
void |
setOwner(Object owner)
Set the reference to the owning entity
|
void |
setSnapshot(Serializable key,
String role,
Serializable snapshot)
After flushing, re-init snapshot state.
|
boolean |
unsetSession(SessionImplementor currentSession)
Disassociate this collection from the given session.
|
boolean |
wasInitialized()
Is this instance initialized?
|
protected void |
write()
Called by any writer method of the collection interface
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbeforeInitialize, disassemble, entries, entryExists, equalsSnapshot, getDeletes, getElement, getIndex, getSnapshot, getSnapshotElement, initializeFromCache, isSnapshotEmpty, isWrapper, needsInserting, needsUpdating, readFromprotected static final Object UNKNOWN
public AbstractPersistentCollection()
protected AbstractPersistentCollection(SessionImplementor session)
public final String getRole()
PersistentCollectiongetRole in interface PersistentCollectionpublic final Serializable getKey()
PersistentCollectiongetKey in interface PersistentCollectionpublic final boolean isUnreferenced()
PersistentCollectionisUnreferenced in interface PersistentCollectiontrue if the collection is no longer referenced by an ownerpublic final boolean isDirty()
PersistentCollectionisDirty in interface PersistentCollectiontrue if the collection is dirtypublic final void clearDirty()
PersistentCollectionclearDirty in interface PersistentCollectionpublic final void dirty()
PersistentCollectiondirty in interface PersistentCollectionpublic final Serializable getStoredSnapshot()
PersistentCollectiongetStoredSnapshot in interface PersistentCollectionpublic abstract boolean empty()
PersistentCollectionempty in interface PersistentCollectionfalse if the collection is non-empty; true otherwise.protected final void read()
protected boolean readSize()
Collection.size() methodprotected int getCachedSize()
protected boolean isConnectedToSession()
protected boolean isInitialized()
protected final void write()
protected boolean isOperationQueueEnabled()
protected boolean isPutQueueEnabled()
protected boolean isClearQueueEnabled()
protected boolean isInverseCollection()
protected boolean isInverseCollectionNoOrphanDelete()
protected boolean isInverseOneToManyOrNoOrphanDelete()
protected final void queueOperation(AbstractPersistentCollection.DelayedOperation operation)
public final void replaceQueuedOperationValues(CollectionPersister persister, Map copyCache)
copyCache/.copyCache - - mapping from entity in the process of being
merged to managed copy.protected final void performQueuedOperations()
public void setSnapshot(Serializable key, String role, Serializable snapshot)
PersistentCollectionsetSnapshot in interface PersistentCollectionkey - The collection instance key (fk value).role - The collection rolesnapshot - The snapshot statepublic void postAction()
PersistentCollectionpostAction in interface PersistentCollectionpublic Object getValue()
PersistentCollectiongetValue in interface PersistentCollectionpublic void beginRead()
PersistentCollectionbeginRead in interface PersistentCollectionpublic boolean endRead()
PersistentCollectionendRead in interface PersistentCollectionpublic boolean afterInitialize()
PersistentCollectionafterInitialize in interface PersistentCollectionprotected final void initialize(boolean writing)
writing - currently obsoleteLazyInitializationException - if we cannot initializeprotected final void setInitialized()
protected final void setDirectlyAccessible(boolean directlyAccessible)
public boolean isDirectlyAccessible()
PersistentCollectionisDirectlyAccessible in interface PersistentCollectiontrue indicates that the application might have access to the underlying collection/array.public final boolean unsetSession(SessionImplementor currentSession)
PersistentCollectionunsetSession in interface PersistentCollectioncurrentSession - The session we are disassociating from. Used for validations.protected void prepareForPossibleLoadingOutsideTransaction()
public final boolean setCurrentSession(SessionImplementor session) throws HibernateException
PersistentCollectionsetCurrentSession in interface PersistentCollectionsession - The session to associate withHibernateException - if the collection was already associated
with another open sessionpublic boolean needsRecreate(CollectionPersister persister)
PersistentCollectionneedsRecreate in interface PersistentCollectionpersister - The collection persistertrue if a change requires a recreate.public final void forceInitialization()
throws HibernateException
PersistentCollectionforceInitialization in interface PersistentCollectionHibernateExceptionprotected final Serializable getSnapshot()
public final boolean wasInitialized()
PersistentCollectionwasInitialized in interface PersistentCollectionpublic boolean isRowUpdatePossible()
PersistentCollectionisRowUpdatePossible in interface PersistentCollectiontrue if the row for each element is knownpublic final boolean hasQueuedOperations()
PersistentCollectionhasQueuedOperations in interface PersistentCollectiontrue indicates there are pending, queued, delayed operationspublic final Iterator queuedAdditionIterator()
PersistentCollectionqueuedAdditionIterator in interface PersistentCollectionpublic final Collection getQueuedOrphans(String entityName)
PersistentCollectiongetQueuedOrphans in interface PersistentCollectionentityName - The name of the entity that makes up the elementspublic void preInsert(CollectionPersister persister) throws HibernateException
PersistentCollectionpreInsert in interface PersistentCollectionpersister - The collection persisterHibernateExceptionpublic void afterRowInsert(CollectionPersister persister, Object entry, int i) throws HibernateException
PersistentCollectionafterRowInsert in interface PersistentCollectionpersister - The collection persisterentry - The collection element just insertedi - The element position/indexHibernateExceptionpublic abstract Collection getOrphans(Serializable snapshot, String entityName) throws HibernateException
PersistentCollectiongetOrphans in interface PersistentCollectionsnapshot - The snapshot stateentityName - The name of the entity that are the elements of the collectionHibernateExceptionpublic final SessionImplementor getSession()
protected static Collection getOrphans(Collection oldElements, Collection currentElements, String entityName, SessionImplementor session) throws HibernateException
HibernateExceptionpublic static void identityRemove(Collection list, Object entityInstance, String entityName, SessionImplementor session)
list - The list containing the entity instancesentityInstance - The entity instance to match elements.entityName - The entity namesession - The sessionpublic Object getIdentifier(Object entry, int i)
PersistentCollectionidbag collection.getIdentifier in interface PersistentCollectionentry - The collection entry/elementi - The assumed identifier (?)public Object getOwner()
PersistentCollectiongetOwner in interface PersistentCollectionpublic void setOwner(Object owner)
PersistentCollectionsetOwner in interface PersistentCollectionowner - The ownerCopyright © 2017 JBoss by Red Hat. All rights reserved.