Top Description Fields Constructors Methods
org.hibernate.engine.spi

public final Class CollectionEntry

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
org.hibernate.AssertionFailure, .HibernateException, org.hibernate.collection.spi.AbstractPersistentCollection, .PersistentCollection, org.hibernate.internal.CoreLogging, .CoreMessageLogger, org.hibernate.internal.util.NullnessUtil, org.hibernate.persister.collection.CollectionPersister, org.hibernate.pretty.MessageHelper, java.io.IOException, .ObjectInputStream, .ObjectOutputStream, .Serializable, java.util.Collection, org.checkerframework.checker.initialization.qual.UnderInitialization, org.checkerframework.checker.nullness.qual.Nullable

We need an entry to tell us all about the current state of a collection with respect to its persistent state
Author
Gavin King

Field Summary

Modifier and TypeField and Description
private transient @Nullable Object
private transient @Nullable CollectionPersister
private transient boolean
private transient boolean
private transient boolean
private boolean
private transient boolean
private @Nullable Object
private transient @Nullable CollectionPersister
private static final CoreMessageLogger
private transient boolean
private transient boolean
private @Nullable String
private @Nullable Serializable

Constructor Summary

AccessConstructor and Description
public
CollectionEntry(CollectionPersister persister, PersistentCollection<?> collection)

For newly wrapped collections, or dereferenced collection wrappers

public
CollectionEntry(final PersistentCollection<?> collection, final CollectionPersister loadedPersister, final Object loadedKey, final boolean ignore)

For collections just loaded from the database

public
CollectionEntry(CollectionPersister loadedPersister, Object loadedKey)

For uninitialized detached collections

public
CollectionEntry(PersistentCollection<?> collection, SessionFactoryImplementor factory)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
For initialized detached collections
private
CollectionEntry(@Nullable String role, Serializable snapshot, Object loadedKey, @Nullable SessionFactoryImplementor factory)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
Used from custom serialization.

Method Summary

Modifier and TypeMethod and Description
public void
afterAction(PersistentCollection<?> collection)

Called after execution of an action

pack-priv void
afterDeserialize(@Nullable SessionFactoryImplementor factory)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
public static CollectionEntry

Returns:

The deserialized CollectionEntry
deserialize
(ObjectInputStream
The stream from which to read the entry.
ois
,
SessionImplementor
The session being deserialized.
session
)

Custom deserialization routine used during deserialization of a Session/PersistenceContext for increased performance.

private void
dirty(PersistentCollection<?> collection)

Determine if the collection is "really" dirty, by checking dirtiness of the collection elements, if necessary

public @Nullable Object
getCurrentKey()

This is only available late during the flush cycle

public @Nullable CollectionPersister
public @Nullable Object
public @Nullable Object
public @Nullable CollectionPersister
getLoadedPersister()

This is only available late during the flush cycle

public Collection<?>
getOrphans(String entityName, PersistentCollection<?> collection)

Get the collection orphans (entities which were removed from the collection)

public @Nullable String
public @Nullable Serializable
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public void
postFlush(PersistentCollection<?> collection)

Called after a successful flush

public void
public void
public void
resetStoredSnapshot(PersistentCollection<?>
the persistentcollection to be updated
collection
,
Serializable
the new stored snapshot
storedSnapshot
)

Reset the stored snapshot for both the persistent collection and this collection entry.

public void
serialize(ObjectOutputStream
The stream to which we should write the serial data.
oos
)

Custom serialization routine used during serialization of a Session/PersistenceContext for increased performance.

public void
public void
public void
setDorecreate(boolean dorecreate)

public void
setDoremove(boolean doremove)

public void
setDoupdate(boolean doupdate)

private void
public void
setProcessed(boolean processed)

public void
setReached(boolean reached)

public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

currentKeyback to summary
private transient @Nullable Object currentKey
currentPersisterback to summary
private transient @Nullable CollectionPersister currentPersister
dorecreateback to summary
private transient boolean dorecreate
doremoveback to summary
private transient boolean doremove
doupdateback to summary
private transient boolean doupdate
fromMergeback to summary
private boolean fromMerge
ignoreback to summary
private transient boolean ignore
loadedKeyback to summary
private @Nullable Object loadedKey
loadedPersisterback to summary
private transient @Nullable CollectionPersister loadedPersister
LOGback to summary
private static final CoreMessageLogger LOG
processedback to summary
private transient boolean processed
reachedback to summary
private transient boolean reached
roleback to summary
private @Nullable String role
snapshotback to summary
private @Nullable Serializable snapshot

Constructor Detail

CollectionEntryback to summary
public CollectionEntry(CollectionPersister persister, PersistentCollection<?> collection)

For newly wrapped collections, or dereferenced collection wrappers

CollectionEntryback to summary
public CollectionEntry(final PersistentCollection<?> collection, final CollectionPersister loadedPersister, final Object loadedKey, final boolean ignore)

For collections just loaded from the database

CollectionEntryback to summary
public CollectionEntry(CollectionPersister loadedPersister, Object loadedKey)

For uninitialized detached collections

CollectionEntryback to summary
public CollectionEntry(PersistentCollection<?> collection, SessionFactoryImplementor factory)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

For initialized detached collections

CollectionEntryback to summary
private CollectionEntry(@Nullable String role, Serializable snapshot, Object loadedKey, @Nullable SessionFactoryImplementor factory)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

Used from custom serialization.

See Also
serialize, deserialize

Method Detail

afterActionback to summary
public void afterAction(PersistentCollection<?> collection)

Called after execution of an action

afterDeserializeback to summary
pack-priv void afterDeserialize(@Nullable SessionFactoryImplementor factory)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

deserializeback to summary
public static CollectionEntry deserialize(ObjectInputStream ois, SessionImplementor session) throws IOException, ClassNotFoundException

Custom deserialization routine used during deserialization of a Session/PersistenceContext for increased performance.

Parameters
ois:ObjectInputStream

The stream from which to read the entry.

session:SessionImplementor

The session being deserialized.

Returns:CollectionEntry

The deserialized CollectionEntry

dirtyback to summary
private void dirty(PersistentCollection<?> collection) throws HibernateException

Determine if the collection is "really" dirty, by checking dirtiness of the collection elements, if necessary

getCurrentKeyback to summary
public @Nullable Object getCurrentKey()

This is only available late during the flush cycle

getCurrentPersisterback to summary
public @Nullable CollectionPersister getCurrentPersister()
getKeyback to summary
public @Nullable Object getKey()
getLoadedKeyback to summary
public @Nullable Object getLoadedKey()
getLoadedPersisterback to summary
public @Nullable CollectionPersister getLoadedPersister()

This is only available late during the flush cycle

getOrphansback to summary
public Collection<?> getOrphans(String entityName, PersistentCollection<?> collection) throws HibernateException

Get the collection orphans (entities which were removed from the collection)

getRoleback to summary
public @Nullable String getRole()
getSnapshotback to summary
public @Nullable Serializable getSnapshot()
isDorecreateback to summary
public boolean isDorecreate()
isDoremoveback to summary
public boolean isDoremove()
isDoupdateback to summary
public boolean isDoupdate()
isIgnoreback to summary
public boolean isIgnore()
isProcessedback to summary
public boolean isProcessed()
isReachedback to summary
public boolean isReached()
isSnapshotEmptyback to summary
public boolean isSnapshotEmpty(PersistentCollection<?> collection)
postFlushback to summary
public void postFlush(PersistentCollection<?> collection) throws HibernateException

Called after a successful flush

postInitializeback to summary
public void postInitialize(PersistentCollection<?> collection) throws HibernateException
preFlushback to summary
public void preFlush(PersistentCollection<?> collection) throws HibernateException
resetStoredSnapshotback to summary
public void resetStoredSnapshot(PersistentCollection<?> collection, Serializable storedSnapshot)

Reset the stored snapshot for both the persistent collection and this collection entry. Used during the merge of detached collections.

Parameters
collection:PersistentCollection<?>

the persistentcollection to be updated

storedSnapshot:Serializable

the new stored snapshot

serializeback to summary
public void serialize(ObjectOutputStream oos) throws IOException

Custom serialization routine used during serialization of a Session/PersistenceContext for increased performance.

Parameters
oos:ObjectOutputStream

The stream to which we should write the serial data.

setCurrentKeyback to summary
public void setCurrentKey(@Nullable Object currentKey)
setCurrentPersisterback to summary
public void setCurrentPersister(@Nullable CollectionPersister currentPersister)
setDorecreateback to summary
public void setDorecreate(boolean dorecreate)
setDoremoveback to summary
public void setDoremove(boolean doremove)
setDoupdateback to summary
public void setDoupdate(boolean doupdate)
setLoadedPersisterback to summary
private void setLoadedPersister(@Nullable CollectionPersister persister)
setProcessedback to summary
public void setProcessed(boolean processed)
setReachedback to summary
public void setReached(boolean reached)
setRoleback to summary
public void setRole(@Nullable String role)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
wasDereferencedback to summary
public boolean wasDereferenced()