| org.hibernate.collection.PersistentCollection
All known Subclasses: org.hibernate.collection.AbstractPersistentCollection,
PersistentCollection | public interface PersistentCollection (Code) | | Persistent collections are treated as value objects by Hibernate.
ie. they have no independent existence beyond the object holding
a reference to them. Unlike instances of entity classes, they are
automatically deleted when unreferenced and automatically become
persistent when held by a persistent object. Collections can be
passed between different objects (change "roles") and this might
cause their elements to move from one database table to another.
Hibernate "wraps" a java collection in an instance of
PersistentCollection. This mechanism is designed to support
tracking of changes to the collection's persistent state and
lazy instantiation of collection elements. The downside is that
only certain abstract collection types are supported and any
extra semantics are lost
Applications should never use classes in this package
directly, unless extending the "framework" here.
Changes to structure of the collection are recorded by the
collection calling back to the session. Changes to mutable
elements (ie. composite elements) are discovered by cloning their
state when the collection is initialized and comparing at flush
time.
author: Gavin King |
Method Summary | |
public boolean | afterInitialize() | public void | afterRowInsert(CollectionPersister persister, Object entry, int i) | public void | beforeInitialize(CollectionPersister persister, int anticipatedSize) Called before any elements are read into the collection,
allowing appropriate initializations to occur. | public void | beginRead() | public void | clearDirty() Clear the dirty flag, after flushing changes
to the database. | public void | dirty() | public Serializable | disassemble(CollectionPersister persister) | public boolean | empty() | public boolean | endRead() | public Iterator | entries(CollectionPersister persister) | public boolean | entryExists(Object entry, int i) | public boolean | equalsSnapshot(CollectionPersister persister) | public void | forceInitialization() To be called internally by the session, forcing
immediate initialization. | public Iterator | getDeletes(CollectionPersister persister, boolean indexIsFormula) | public Object | getElement(Object entry) | public Object | getIdentifier(Object entry, int i) | public Object | getIndex(Object entry, int i, CollectionPersister persister) | public Serializable | getKey() | public Collection | getOrphans(Serializable snapshot, String entityName) | public Object | getOwner() Get the owning entity. | public Collection | getQueuedOrphans(String entityName) | public String | getRole() | public Serializable | getSnapshot(CollectionPersister persister) | public Object | getSnapshotElement(Object entry, int i) | public Serializable | getStoredSnapshot() | public Object | getValue() | public boolean | hasQueuedOperations() | public void | initializeFromCache(CollectionPersister persister, Serializable disassembled, Object owner) | public boolean | isDirectlyAccessible() | public 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. | public boolean | isRowUpdatePossible() | public boolean | isSnapshotEmpty(Serializable snapshot) | public boolean | isUnreferenced() | public boolean | isWrapper(Object collection) | public boolean | needsInserting(Object entry, int i, Type elemType) | public boolean | needsRecreate(CollectionPersister persister) | public boolean | needsUpdating(Object entry, int i, Type elemType) | public void | postAction() After flushing, clear any "queued" additions, since the
database state is now synchronized with the memory state. | public void | preInsert(CollectionPersister persister) | public Iterator | queuedAdditionIterator() | public Object | readFrom(ResultSet rs, CollectionPersister role, CollectionAliases descriptor, Object owner) | public boolean | setCurrentSession(SessionImplementor session) Associate the collection with the given session. | public void | setOwner(Object entity) | public void | setSnapshot(Serializable key, String role, Serializable snapshot) After flushing, re-init snapshot state. | public boolean | unsetSession(SessionImplementor currentSession) Disassociate this collection from the given session. | public boolean | wasInitialized() |
afterInitialize | public boolean afterInitialize()(Code) | | Called after initializing from cache
|
beforeInitialize | public void beforeInitialize(CollectionPersister persister, int anticipatedSize)(Code) | | Called before any elements are read into the collection,
allowing appropriate initializations to occur.
Parameters: persister - The underlying collection persister. Parameters: anticipatedSize - The anticipated size of the collection after initilization is complete. |
beginRead | public void beginRead()(Code) | | Called just before reading any rows from the JDBC result set
|
clearDirty | public void clearDirty()(Code) | | Clear the dirty flag, after flushing changes
to the database.
|
dirty | public void dirty()(Code) | | Mark the collection as dirty
|
empty | public boolean empty()(Code) | | Is the collection empty? (don't try to initialize the collection)
|
endRead | public boolean endRead()(Code) | | Called after reading all rows from the JDBC result set
|
entryExists | public boolean entryExists(Object entry, int i)(Code) | | Does an element exist at this entry in the collection?
|
forceInitialization | public void forceInitialization() throws HibernateException(Code) | | To be called internally by the session, forcing
immediate initialization.
|
getElement | public Object getElement(Object entry)(Code) | | Get the value of the given collection entry
|
getIdentifier | public Object getIdentifier(Object entry, int i)(Code) | | Get the index of the given collection entry
|
getIndex | public Object getIndex(Object entry, int i, CollectionPersister persister)(Code) | | Get the index of the given collection entry
Parameters: persister - it was more elegant before we added this... |
getOwner | public Object getOwner()(Code) | | Get the owning entity. Note that the owner is only
set during the flush cycle, and when a new collection
wrapper is created while loading an entity.
|
getRole | public String getRole()(Code) | | Get the current role name
|
getSnapshotElement | public Object getSnapshotElement(Object entry, int i)(Code) | | Get the snapshot value of the given collection entry
|
getStoredSnapshot | public Serializable getStoredSnapshot()(Code) | | Get the snapshot cached by the collection
instance
|
getValue | public Object getValue()(Code) | | return the user-visible collection (or array) instance
|
hasQueuedOperations | public boolean hasQueuedOperations()(Code) | | Does this instance have any "queued" additions?
|
isDirectlyAccessible | public boolean isDirectlyAccessible()(Code) | | Could the application possibly have a direct reference to
the underlying collection implementation?
|
isDirty | public boolean isDirty()(Code) | | Is the collection dirty? Note that this is only
reliable during the flush cycle, after the
collection elements are dirty checked against
the snapshot.
|
isRowUpdatePossible | public boolean isRowUpdatePossible()(Code) | | |
isSnapshotEmpty | public boolean isSnapshotEmpty(Serializable snapshot)(Code) | | Is the snapshot empty?
|
isUnreferenced | public boolean isUnreferenced()(Code) | | Is the collection unreferenced?
|
isWrapper | public boolean isWrapper(Object collection)(Code) | | Is this the wrapper for the given underlying collection instance?
|
needsRecreate | public boolean needsRecreate(CollectionPersister persister)(Code) | | Do we need to completely recreate this collection when it changes?
|
postAction | public void postAction()(Code) | | After flushing, clear any "queued" additions, since the
database state is now synchronized with the memory state.
|
queuedAdditionIterator | public Iterator queuedAdditionIterator()(Code) | | Iterate the "queued" additions
|
setCurrentSession | public boolean setCurrentSession(SessionImplementor session) throws HibernateException(Code) | | Associate the collection with the given session.
false if the collection was already associated with the session throws: HibernateException - if the collection was already associatedwith another open session |
setOwner | public void setOwner(Object entity)(Code) | | Set the reference to the owning entity
|
unsetSession | public boolean unsetSession(SessionImplementor currentSession)(Code) | | Disassociate this collection from the given session.
true if this was currently associated with the given session |
wasInitialized | public boolean wasInitialized()(Code) | | Is this instance initialized?
|
|
|