Top Description Inners Fields Constructors Methods
org.hibernate.collection

public abstract Class AbstractPersistentCollection

extends Object
implements Serializable, PersistentCollection
Class Inheritance
All Implemented Interfaces
org.hibernate.collection.PersistentCollection, java.io.Serializable
Known Direct Subclasses
org.hibernate.collection.PersistentArrayHolder, org.hibernate.collection.PersistentBag, org.hibernate.collection.PersistentElementHolder, org.hibernate.collection.PersistentIdentifierBag, org.hibernate.collection.PersistentIndexedElementHolder, org.hibernate.collection.PersistentList, org.hibernate.collection.PersistentMap, org.hibernate.collection.PersistentSet
Imports
java.io.Serializable, java.util.ArrayList, .Collection, .HashSet, .Iterator, .List, .ListIterator, org.hibernate.AssertionFailure, .HibernateException, .LazyInitializationException, org.hibernate.engine.CollectionEntry, .EntityEntry, .ForeignKeys, .SessionImplementor, .Status, .TypedValue, org.hibernate.persister.collection.CollectionPersister, org.hibernate.pretty.MessageHelper, org.hibernate.type.Type, org.hibernate.util.CollectionHelper, .EmptyIterator, .IdentitySet, .MarkerObject

Base class implementing PersistentCollection
Author
Gavin King

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static interface
pack-priv class
pack-priv class
pack-priv class
pack-priv class

Field Summary

Modifier and TypeField and Description
private int
private transient boolean
private boolean
private boolean
private transient boolean
private Serializable
private transient List<E>
private Object
private String
private transient SessionImplementor
private Serializable
protected static final Object

Constructor Summary

AccessConstructor and Description
public
AbstractPersistentCollection()

Not called by Hibernate, but used by non-JDK serialization, eg.

protected

Method Summary

Modifier and TypeMethod and Description
public boolean
afterInitialize()

Implements org.hibernate.collection.PersistentCollection.afterInitialize.

Called after initializing from cache
public void
afterRowInsert(CollectionPersister persister, Object entry, int i)

Implements org.hibernate.collection.PersistentCollection.afterRowInsert.

Called after inserting a row, to fetch the natively generated id
public void
beginRead()

Implements org.hibernate.collection.PersistentCollection.beginRead.

Called just before reading any rows from the JDBC result set
public final void
clearDirty()

Implements org.hibernate.collection.PersistentCollection.clearDirty.

Clear the dirty flag, after flushing changes to the database.
public final void
dirty()

Implements org.hibernate.collection.PersistentCollection.dirty.

Mark the collection as dirty
public abstract boolean
empty()

Redeclares org.hibernate.collection.PersistentCollection.empty.

Is the initialized collection empty?
public boolean
endRead()

Implements org.hibernate.collection.PersistentCollection.endRead.

Called after reading all rows from the JDBC result set
public final void
forceInitialization()

Implements org.hibernate.collection.PersistentCollection.forceInitialization.

To be called internally by the session, forcing immediate initialization.
protected int
public Object
getIdentifier(Object entry, int i)

Implements org.hibernate.collection.PersistentCollection.getIdentifier.

Get the index of the given collection entry
public final Serializable
getKey()

Implements org.hibernate.collection.PersistentCollection.getKey.

Get the current collection key value
public abstract Collection<E>
getOrphans(Serializable snapshot, String entityName)

Redeclares org.hibernate.collection.PersistentCollection.getOrphans.

get all "orphaned" elements
protected static Collection<E>
getOrphans(Collection<E> oldElements, Collection<E> 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

public Object
public final Collection<E>
getQueuedOrphans(String entityName)

Implements org.hibernate.collection.PersistentCollection.getQueuedOrphans.

Iterate the "queued" additions
public final String
getRole()

Implements org.hibernate.collection.PersistentCollection.getRole.

Get the current role name
public final SessionImplementor
getSession()

Get the current session

protected final Serializable
getSnapshot()

Get the current snapshot from the session

public final Serializable
getStoredSnapshot()

Implements org.hibernate.collection.PersistentCollection.getStoredSnapshot.

Get the snapshot cached by the collection instance
public Object
getValue()

Implements org.hibernate.collection.PersistentCollection.getValue.

return the user-visible collection (or array) instance
public final boolean
hasQueuedOperations()

Implements org.hibernate.collection.PersistentCollection.hasQueuedOperations.

Does this instance have any "queued" additions?
pack-priv static void
identityRemove(Collection<E> list, Object object, String entityName, SessionImplementor session)

protected final void
initialize(boolean
currently obsolete
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?

private final boolean
isConnectedToSession()

Is the collection currently connected to an open session?

public boolean
isDirectlyAccessible()

Implements org.hibernate.collection.PersistentCollection.isDirectlyAccessible.

Could the application possibly have a direct reference to the underlying collection implementation?
public final boolean
isDirty()

Implements org.hibernate.collection.PersistentCollection.isDirty.

Is the collection dirty?
private boolean
isInverseCollection()

Is this the "inverse" end of a bidirectional association?

private boolean
isInverseCollectionNoOrphanDelete()

Is this the "inverse" end of a bidirectional association with no orphan delete enabled?

private 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?

public boolean
public final boolean
public boolean
needsRecreate(CollectionPersister persister)

Implements org.hibernate.collection.PersistentCollection.needsRecreate.

Do we need to completely recreate this collection when it changes?
protected final void
performQueuedOperations()

After reading all existing elements from the database, add the queued elements to the underlying collection.

public void
postAction()

Implements org.hibernate.collection.PersistentCollection.postAction.

After flushing, clear any "queued" additions, since the database state is now synchronized with the memory state.
public void
preInsert(CollectionPersister persister)

Implements org.hibernate.collection.PersistentCollection.preInsert.

Called before inserting rows, to ensure that any surrogate keys are fully generated
public final Iterator<E>
protected final void
queueOperation(Object element)

Queue an addition

protected final void
read()

Called by any read-only method of the collection interface

protected Object
protected Boolean
protected Boolean
protected boolean
readSize()

Called by the size() method

public final boolean

Returns:

false if the collection was already associated with the session
setCurrentSession
(SessionImplementor session)

Implements org.hibernate.collection.PersistentCollection.setCurrentSession.

Associate the collection with the given session.
protected final void
setDirectlyAccessible(boolean directlyAccessible)

protected final void
public void
setOwner(Object owner)

Implements org.hibernate.collection.PersistentCollection.setOwner.

Set the reference to the owning entity
public void
setSnapshot(Serializable key, String role, Serializable snapshot)

Implements org.hibernate.collection.PersistentCollection.setSnapshot.

After flushing, re-init snapshot state.
private void
private void
public final boolean

Returns:

true if this was currently associated with the given session
unsetSession
(SessionImplementor currentSession)

Implements org.hibernate.collection.PersistentCollection.unsetSession.

Disassociate this collection from the given session.
public final boolean
protected final void
write()

Called by any writer method of the collection interface

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait