Top Description Inners Fields Constructors Methods
org.hibernate.collection.internal

public abstract Class AbstractPersistentCollection

extends Object
implements Serializable, PersistentCollection
Class Inheritance
All Implemented Interfaces
org.hibernate.collection.spi.PersistentCollection, org.hibernate.collection.spi.LazyInitializable, java.io.Serializable
Known Direct Subclasses
org.hibernate.collection.internal.PersistentArrayHolder, org.hibernate.collection.internal.PersistentBag, org.hibernate.collection.internal.PersistentIdentifierBag, org.hibernate.collection.internal.PersistentList, org.hibernate.collection.internal.PersistentMap, org.hibernate.collection.internal.PersistentSet
Imports
java.io.Serializable, java.util.ArrayList, .Collection, .Collections, .HashSet, .Iterator, .List, .ListIterator, .Map, org.hibernate.AssertionFailure, .FlushMode, .HibernateException, .LazyInitializationException, .Session, org.hibernate.collection.spi.PersistentCollection, org.hibernate.engine.internal.ForeignKeys, org.hibernate.engine.spi.CollectionEntry, .EntityEntry, .PersistenceContext, .SessionFactoryImplementor, .SessionImplementor, .SharedSessionContractImplementor, .Status, .TypedValue, org.hibernate.internal.CoreLogging, .CoreMessageLogger, .SessionFactoryRegistry, org.hibernate.internal.util.MarkerObject, org.hibernate.internal.util.collections.IdentitySet, org.hibernate.persister.collection.CollectionPersister, org.hibernate.persister.entity.EntityPersister, org.hibernate.pretty.MessageHelper, org.hibernate.resource.transaction.spi.TransactionStatus, org.hibernate.type.CompositeType, .IntegerType, .LongType, .PostgresUUIDType, .StringType, .Type, .UUIDBinaryType, .UUIDCharType

Base class implementing org.hibernate.collection.spi.PersistentCollection
Author
Gavin King

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected abstract class
protected static interface
AbstractPersistentCollection.DelayedOperation

Contract for operations which are part of a collection's operation queue.

protected class
public static interface
AbstractPersistentCollection.LazyInitializationWork<
The java type of the return for this LazyInitializationWork
T
>

TBH not sure why this is public

protected class
protected class
protected class
protected static interface

Field Summary

Modifier and TypeField and Description
private boolean
private int
private transient boolean
private boolean
protected boolean
private boolean
private transient boolean
private boolean
private Serializable
private static final CoreMessageLogger
private transient List<AbstractPersistentCollection.DelayedOperation>
private Object
private String
private transient SharedSessionContractImplementor
private String
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
protected

Method Summary

Modifier and TypeMethod and Description
public boolean
public void
afterRowInsert(CollectionPersister
The collection persister
persister
,
Object
The collection element just inserted
entry
,
int
The element position/index
i
)

Implements org.hibernate.collection.spi.PersistentCollection.afterRowInsert.

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

Implements org.hibernate.collection.spi.PersistentCollection.beginRead.

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

Implements org.hibernate.collection.spi.PersistentCollection.clearDirty.

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

Implements org.hibernate.collection.spi.PersistentCollection.dirty.

Mark the collection as dirty
public abstract boolean
empty()

Redeclares org.hibernate.collection.spi.PersistentCollection.empty.

Is the collection empty?
public boolean
endRead()

Implements org.hibernate.collection.spi.PersistentCollection.endRead.

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

Implements org.hibernate.collection.spi.LazyInitializable.forceInitialization.

To be called internally by the session, forcing immediate initialization.
private String
protected int
public Object
getIdentifier(Object
The collection entry/element
entry
,
int
The assumed identifier (?)
i
)

Implements org.hibernate.collection.spi.PersistentCollection.getIdentifier.

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

Implements org.hibernate.collection.spi.PersistentCollection.getKey.

Get the current collection key value
public abstract Collection<E>
getOrphans(Serializable
The snapshot state
snapshot
,
String
The name of the entity that are the elements of the collection
entityName
)

Redeclares org.hibernate.collection.spi.PersistentCollection.getOrphans.

get all "orphaned" elements
protected static Collection<E>
getOrphans(Collection<E> oldElements, Collection<E> currentElements, String entityName, SharedSessionContractImplementor 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
The name of the entity that makes up the elements
entityName
)

Implements org.hibernate.collection.spi.PersistentCollection.getQueuedOrphans.

Get the "queued" orphans
public final String
public final SharedSessionContractImplementor

Returns:

The session
getSession
()

Get the session currently associated with this collection.

protected final Serializable
getSnapshot()

Get the current snapshot from the session

public final Serializable
getStoredSnapshot()

Implements org.hibernate.collection.spi.PersistentCollection.getStoredSnapshot.

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

Implements org.hibernate.collection.spi.PersistentCollection.getValue.

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

Implements org.hibernate.collection.spi.PersistentCollection.hasQueuedOperations.

Does this instance have any "queued" operations?
public static void
identityRemove(Collection<E>
The list containing the entity instances
list
,
Object
The entity instance to match elements.
entityInstance
,
String
The entity name
entityName
,
SharedSessionContractImplementor
The session
session
)

Removes entity entries that have an equal identifier with the incoming entity instance

public static void
identityRemove(Collection<E>
The list containing the entity instances
list
,
Object
The entity instance to match elements.
entityInstance
,
String
The entity name
entityName
,
SessionImplementor
The session
session
)

Removes entity entries that have an equal identifier with the incoming entity instance
protected final void
initialize(final 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?

protected boolean
public boolean
isDirectlyAccessible()

Implements org.hibernate.collection.spi.PersistentCollection.isDirectlyAccessible.

Could the application possibly have a direct reference to the underlying collection implementation?
public final boolean
public boolean
protected boolean
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?

public boolean
isRowUpdatePossible()

Implements org.hibernate.collection.spi.PersistentCollection.isRowUpdatePossible.

Can each element in the collection be mapped unequivocally to a single row in the database?
public final boolean
private static boolean
public boolean
needsRecreate(CollectionPersister
The collection persister
persister
)

Implements org.hibernate.collection.spi.PersistentCollection.needsRecreate.

Do we need to completely recreate this collection when it changes?
private SharedSessionContractImplementor
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.spi.PersistentCollection.postAction.

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

Implements org.hibernate.collection.spi.PersistentCollection.preInsert.

Called before inserting rows, to ensure that any surrogate keys are fully generated
protected void
public final Iterator<E>
protected final void
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 Collection#size method

public final void
replaceQueuedOperationValues(CollectionPersister persister, Map<K, V>
- mapping from entity in the process of being merged to managed copy.
copyCache
)

Replace entity instances with copy in copyCache/.

public final boolean
setCurrentSession(SharedSessionContractImplementor
The session to associate with
session
)

Implements org.hibernate.collection.spi.PersistentCollection.setCurrentSession.

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

protected final void
public void
setOwner(Object
The owner
owner
)

Implements org.hibernate.collection.spi.PersistentCollection.setOwner.

Set the reference to the owning entity
public void
setSnapshot(Serializable
The collection instance key (fk value).
key
,
String
The collection role
role
,
Serializable
The snapshot state
snapshot
)

Implements org.hibernate.collection.spi.PersistentCollection.setSnapshot.

After flushing, re-init snapshot state.
private void
private void
public final boolean
unsetSession(SharedSessionContractImplementor
The session we are disassociating from. Used for validations.
currentSession
)

Implements org.hibernate.collection.spi.PersistentCollection.unsetSession.

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

Called by any writer method of the collection interface

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait