Package org.hibernate.engine.spi
Class CollectionEntry
java.lang.Object
org.hibernate.engine.spi.CollectionEntry
- All Implemented Interfaces:
Serializable
We need an entry to tell us all about the current state
of a collection with respect to its persistent state
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCollectionEntry
(PersistentCollection<?> collection, SessionFactoryImplementor factory) For initialized detached collectionsCollectionEntry
(PersistentCollection<?> collection, CollectionPersister loadedPersister, Object loadedKey, boolean ignore) For collections just loaded from the databaseCollectionEntry
(CollectionPersister loadedPersister, Object loadedKey) For uninitialized detached collectionsCollectionEntry
(CollectionPersister persister, PersistentCollection<?> collection) For newly wrapped collections, or dereferenced collection wrappers -
Method Summary
Modifier and TypeMethodDescriptionvoid
afterAction
(PersistentCollection<?> collection) Called after execution of an actionstatic CollectionEntry
deserialize
(ObjectInputStream ois, SessionImplementor session) Custom deserialization routine used during deserialization of a Session/PersistenceContext for increased performance.@Nullable Object
This is only available late during the flush cycle@Nullable CollectionPersister
@Nullable Object
getKey()
@Nullable Object
@Nullable CollectionPersister
This is only available late during the flush cycleCollection<?>
getOrphans
(String entityName, PersistentCollection<?> collection) Get the collection orphans (entities which were removed from the collection)@Nullable String
getRole()
@Nullable Serializable
boolean
boolean
boolean
boolean
isIgnore()
boolean
boolean
boolean
isSnapshotEmpty
(PersistentCollection<?> collection) void
postFlush
(PersistentCollection<?> collection) Called after a successful flushvoid
postInitialize
(PersistentCollection<?> collection, SharedSessionContractImplementor session) void
preFlush
(PersistentCollection<?> collection) void
resetStoredSnapshot
(PersistentCollection<?> collection, Serializable storedSnapshot) Reset the stored snapshot for both the persistent collection and this collection entry.void
Custom serialization routine used during serialization of a Session/PersistenceContext for increased performance.void
setCurrentKey
(@Nullable Object currentKey) void
setCurrentPersister
(@Nullable CollectionPersister currentPersister) void
setDorecreate
(boolean dorecreate) void
setDoremove
(boolean doremove) void
setDoupdate
(boolean doupdate) void
setProcessed
(boolean processed) void
setReached
(boolean reached) void
toString()
boolean
-
Constructor Details
-
CollectionEntry
For newly wrapped collections, or dereferenced collection wrappers -
CollectionEntry
public CollectionEntry(PersistentCollection<?> collection, CollectionPersister loadedPersister, Object loadedKey, boolean ignore) For collections just loaded from the database -
CollectionEntry
For uninitialized detached collections -
CollectionEntry
For initialized detached collections
-
-
Method Details
-
preFlush
- Throws:
HibernateException
-
postFlush
Called after a successful flush- Throws:
HibernateException
-
afterAction
Called after execution of an action -
getKey
-
getRole
-
getSnapshot
-
resetStoredSnapshot
Reset the stored snapshot for both the persistent collection and this collection entry. Used during the merge of detached collections.- Parameters:
collection
- the persistentcollection to be updatedstoredSnapshot
- the new stored snapshot
-
wasDereferenced
public boolean wasDereferenced() -
isReached
public boolean isReached() -
setReached
public void setReached(boolean reached) -
isProcessed
public boolean isProcessed() -
setProcessed
public void setProcessed(boolean processed) -
isDoupdate
public boolean isDoupdate() -
setDoupdate
public void setDoupdate(boolean doupdate) -
isDoremove
public boolean isDoremove() -
setDoremove
public void setDoremove(boolean doremove) -
isDorecreate
public boolean isDorecreate() -
setDorecreate
public void setDorecreate(boolean dorecreate) -
isIgnore
public boolean isIgnore() -
getCurrentPersister
-
setCurrentPersister
-
getCurrentKey
This is only available late during the flush cycle -
setCurrentKey
-
getLoadedPersister
This is only available late during the flush cycle -
getLoadedKey
-
setRole
-
toString
-
getOrphans
public Collection<?> getOrphans(String entityName, PersistentCollection<?> collection) throws HibernateException Get the collection orphans (entities which were removed from the collection)- Throws:
HibernateException
-
isSnapshotEmpty
-
serialize
Custom serialization routine used during serialization of a Session/PersistenceContext for increased performance.- Parameters:
oos
- The stream to which we should write the serial data.- Throws:
IOException
-
deserialize
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
- The stream from which to read the entry.session
- The session being deserialized.- Returns:
- The deserialized CollectionEntry
- Throws:
IOException
ClassNotFoundException
-