|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hibernate.collection.AbstractPersistentCollection
public abstract class AbstractPersistentCollection
Base class implementing PersistentCollection
PersistentCollection
,
Serialized FormNested Class Summary | |
---|---|
protected static interface |
AbstractPersistentCollection.DelayedOperation
|
Field Summary | |
---|---|
protected static Object |
UNKNOWN
|
Constructor Summary | |
---|---|
|
AbstractPersistentCollection()
Not called by Hibernate, but used by non-JDK serialization, eg. |
protected |
AbstractPersistentCollection(SessionImplementor session)
|
Method Summary | |
---|---|
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? |
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(Object element)
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 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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.hibernate.collection.PersistentCollection |
---|
beforeInitialize, disassemble, entries, entryExists, equalsSnapshot, getDeletes, getElement, getIndex, getSnapshot, getSnapshotElement, initializeFromCache, isSnapshotEmpty, isWrapper, needsInserting, needsUpdating, readFrom |
Field Detail |
---|
protected static final Object UNKNOWN
Constructor Detail |
---|
public AbstractPersistentCollection()
protected AbstractPersistentCollection(SessionImplementor session)
Method Detail |
---|
public final String getRole()
PersistentCollection
getRole
in interface PersistentCollection
public final Serializable getKey()
PersistentCollection
getKey
in interface PersistentCollection
public final boolean isUnreferenced()
PersistentCollection
isUnreferenced
in interface PersistentCollection
public final boolean isDirty()
PersistentCollection
isDirty
in interface PersistentCollection
public final void clearDirty()
PersistentCollection
clearDirty
in interface PersistentCollection
public final void dirty()
PersistentCollection
dirty
in interface PersistentCollection
public final Serializable getStoredSnapshot()
PersistentCollection
getStoredSnapshot
in interface PersistentCollection
public abstract boolean empty()
empty
in interface PersistentCollection
protected final void read()
protected boolean readSize()
protected Boolean readIndexExistence(Object index)
protected Boolean readElementExistence(Object element)
protected Object readElementByIndex(Object index)
protected int getCachedSize()
protected final void write()
protected boolean isOperationQueueEnabled()
protected boolean isPutQueueEnabled()
protected boolean isClearQueueEnabled()
protected final void queueOperation(Object element)
protected final void performQueuedOperations()
public void setSnapshot(Serializable key, String role, Serializable snapshot)
setSnapshot
in interface PersistentCollection
public void postAction()
postAction
in interface PersistentCollection
public Object getValue()
getValue
in interface PersistentCollection
public void beginRead()
beginRead
in interface PersistentCollection
public boolean endRead()
endRead
in interface PersistentCollection
public boolean afterInitialize()
PersistentCollection
afterInitialize
in interface PersistentCollection
protected final void initialize(boolean writing)
writing
- currently obsolete
LazyInitializationException
- if we cannot initializeprotected final void setInitialized()
protected final void setDirectlyAccessible(boolean directlyAccessible)
public boolean isDirectlyAccessible()
isDirectlyAccessible
in interface PersistentCollection
public final boolean unsetSession(SessionImplementor currentSession)
unsetSession
in interface PersistentCollection
public final boolean setCurrentSession(SessionImplementor session) throws HibernateException
setCurrentSession
in interface PersistentCollection
HibernateException
- if the collection was already associated
with another open sessionpublic boolean needsRecreate(CollectionPersister persister)
needsRecreate
in interface PersistentCollection
public final void forceInitialization() throws HibernateException
forceInitialization
in interface PersistentCollection
HibernateException
protected final Serializable getSnapshot()
public final boolean wasInitialized()
wasInitialized
in interface PersistentCollection
public boolean isRowUpdatePossible()
isRowUpdatePossible
in interface PersistentCollection
public final boolean hasQueuedOperations()
hasQueuedOperations
in interface PersistentCollection
public final Iterator queuedAdditionIterator()
queuedAdditionIterator
in interface PersistentCollection
public final Collection getQueuedOrphans(String entityName)
getQueuedOrphans
in interface PersistentCollection
public void preInsert(CollectionPersister persister) throws HibernateException
preInsert
in interface PersistentCollection
HibernateException
public void afterRowInsert(CollectionPersister persister, Object entry, int i) throws HibernateException
afterRowInsert
in interface PersistentCollection
HibernateException
public abstract Collection getOrphans(Serializable snapshot, String entityName) throws HibernateException
getOrphans
in interface PersistentCollection
HibernateException
public final SessionImplementor getSession()
protected static Collection getOrphans(Collection oldElements, Collection currentElements, String entityName, SessionImplementor session) throws HibernateException
HibernateException
public Object getIdentifier(Object entry, int i)
PersistentCollection
getIdentifier
in interface PersistentCollection
public Object getOwner()
PersistentCollection
getOwner
in interface PersistentCollection
public void setOwner(Object owner)
PersistentCollection
setOwner
in interface PersistentCollection
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |