public abstract class AbstractPersistentCollection extends Object implements Serializable, PersistentCollection
PersistentCollection| Modifier and Type | Class and Description |
|---|---|
protected static interface |
AbstractPersistentCollection.DelayedOperation
Contract for operations which are part of a collection's operation queue.
|
protected class |
AbstractPersistentCollection.IteratorProxy |
protected class |
AbstractPersistentCollection.ListIteratorProxy |
protected class |
AbstractPersistentCollection.ListProxy |
protected class |
AbstractPersistentCollection.SetProxy |
| 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 initialized collection empty?
|
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 index 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)
Iterate the "queued" additions
|
String |
getRole()
Get the current role name
|
SessionImplementor |
getSession()
Get the current session
|
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" additions?
|
static void |
identityRemove(Collection list,
Object object,
String entityName,
SessionImplementor session) |
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.
|
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 |
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() |
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
|
Iterator |
queuedAdditionIterator()
Iterate 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 |
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 PersistentCollectionpublic final boolean isDirty()
PersistentCollectionisDirty in interface PersistentCollectionpublic final void clearDirty()
PersistentCollectionclearDirty in interface PersistentCollectionpublic final void dirty()
PersistentCollectiondirty in interface PersistentCollectionpublic final Serializable getStoredSnapshot()
PersistentCollectiongetStoredSnapshot in interface PersistentCollectionpublic abstract boolean empty()
empty in interface PersistentCollectionprotected final void read()
protected boolean readSize()
Collection.size() methodprotected int getCachedSize()
protected final void write()
protected boolean isOperationQueueEnabled()
protected boolean isPutQueueEnabled()
protected boolean isClearQueueEnabled()
protected final void queueOperation(AbstractPersistentCollection.DelayedOperation operation)
protected final void performQueuedOperations()
public void setSnapshot(Serializable key, String role, Serializable snapshot)
setSnapshot in interface PersistentCollectionpublic void postAction()
postAction in interface PersistentCollectionpublic Object getValue()
getValue in interface PersistentCollectionpublic void beginRead()
beginRead in interface PersistentCollectionpublic boolean endRead()
endRead 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()
isDirectlyAccessible in interface PersistentCollectionpublic final boolean unsetSession(SessionImplementor currentSession)
unsetSession in interface PersistentCollectionpublic final boolean setCurrentSession(SessionImplementor session) throws HibernateException
setCurrentSession in interface PersistentCollectionHibernateException - if the collection was already associated
with another open sessionpublic boolean needsRecreate(CollectionPersister persister)
needsRecreate in interface PersistentCollectionpublic final void forceInitialization()
throws HibernateException
forceInitialization in interface PersistentCollectionHibernateExceptionprotected final Serializable getSnapshot()
public final boolean wasInitialized()
wasInitialized in interface PersistentCollectionpublic boolean isRowUpdatePossible()
isRowUpdatePossible in interface PersistentCollectionpublic final boolean hasQueuedOperations()
hasQueuedOperations in interface PersistentCollectionpublic final Iterator queuedAdditionIterator()
queuedAdditionIterator in interface PersistentCollectionpublic final Collection getQueuedOrphans(String entityName)
getQueuedOrphans in interface PersistentCollectionpublic void preInsert(CollectionPersister persister) throws HibernateException
preInsert in interface PersistentCollectionHibernateExceptionpublic void afterRowInsert(CollectionPersister persister, Object entry, int i) throws HibernateException
afterRowInsert in interface PersistentCollectionHibernateExceptionpublic abstract Collection getOrphans(Serializable snapshot, String entityName) throws HibernateException
getOrphans in interface PersistentCollectionHibernateExceptionpublic final SessionImplementor getSession()
protected static Collection getOrphans(Collection oldElements, Collection currentElements, String entityName, SessionImplementor session) throws HibernateException
HibernateExceptionpublic static void identityRemove(Collection list, Object object, String entityName, SessionImplementor session) throws HibernateException
HibernateExceptionpublic Object getIdentifier(Object entry, int i)
PersistentCollectiongetIdentifier in interface PersistentCollectionpublic Object getOwner()
PersistentCollectiongetOwner in interface PersistentCollectionpublic void setOwner(Object owner)
PersistentCollectionsetOwner in interface PersistentCollectionCopyright © 2012 JBoss by Red Hat. All Rights Reserved.