Package org.hibernate.engine.spi
Class CollectionEntry
- java.lang.Object
-
- org.hibernate.engine.spi.CollectionEntry
-
- All Implemented Interfaces:
java.io.Serializable
public final class CollectionEntry extends java.lang.Object implements java.io.SerializableWe need an entry to tell us all about the current state of a collection with respect to its persistent state- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CollectionEntry(PersistentCollection collection, SessionFactoryImplementor factory)For initialized detached collectionsCollectionEntry(PersistentCollection collection, CollectionPersister loadedPersister, java.io.Serializable loadedKey, boolean ignore)For collections just loaded from the databaseCollectionEntry(CollectionPersister loadedPersister, java.io.Serializable loadedKey)For uninitialized detached collectionsCollectionEntry(CollectionPersister persister, PersistentCollection collection)For newly wrapped collections, or dereferenced collection wrappers
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterAction(PersistentCollection collection)Called after execution of an actionstatic CollectionEntrydeserialize(java.io.ObjectInputStream ois, SessionImplementor session)Custom deserialization routine used during deserialization of a Session/PersistenceContext for increased performance.java.io.SerializablegetCurrentKey()This is only available late during the flush cycleCollectionPersistergetCurrentPersister()java.io.SerializablegetKey()java.io.SerializablegetLoadedKey()CollectionPersistergetLoadedPersister()This is only available late during the flush cyclejava.util.CollectiongetOrphans(java.lang.String entityName, PersistentCollection collection)Get the collection orphans (entities which were removed from the collection)java.lang.StringgetRole()java.io.SerializablegetSnapshot()booleanisDorecreate()booleanisDoremove()booleanisDoupdate()booleanisIgnore()booleanisProcessed()booleanisReached()booleanisSnapshotEmpty(PersistentCollection collection)voidpostFlush(PersistentCollection collection)Called after a successful flushvoidpostInitialize(PersistentCollection collection)voidpreFlush(PersistentCollection collection)voidresetStoredSnapshot(PersistentCollection collection, java.io.Serializable storedSnapshot)Reset the stored snapshot for both the persistent collection and this collection entry.voidserialize(java.io.ObjectOutputStream oos)Custom serialization routine used during serialization of a Session/PersistenceContext for increased performance.voidsetCurrentKey(java.io.Serializable currentKey)voidsetCurrentPersister(CollectionPersister currentPersister)voidsetDorecreate(boolean dorecreate)voidsetDoremove(boolean doremove)voidsetDoupdate(boolean doupdate)voidsetProcessed(boolean processed)voidsetReached(boolean reached)voidsetRole(java.lang.String role)java.lang.StringtoString()booleanwasDereferenced()
-
-
-
Constructor Detail
-
CollectionEntry
public CollectionEntry(CollectionPersister persister, PersistentCollection collection)
For newly wrapped collections, or dereferenced collection wrappers
-
CollectionEntry
public CollectionEntry(PersistentCollection collection, CollectionPersister loadedPersister, java.io.Serializable loadedKey, boolean ignore)
For collections just loaded from the database
-
CollectionEntry
public CollectionEntry(CollectionPersister loadedPersister, java.io.Serializable loadedKey)
For uninitialized detached collections
-
CollectionEntry
public CollectionEntry(PersistentCollection collection, SessionFactoryImplementor factory) throws MappingException
For initialized detached collections- Throws:
MappingException
-
-
Method Detail
-
preFlush
public void preFlush(PersistentCollection collection) throws HibernateException
- Throws:
HibernateException
-
postInitialize
public void postInitialize(PersistentCollection collection) throws HibernateException
- Throws:
HibernateException
-
postFlush
public void postFlush(PersistentCollection collection) throws HibernateException
Called after a successful flush- Throws:
HibernateException
-
afterAction
public void afterAction(PersistentCollection collection)
Called after execution of an action
-
getKey
public java.io.Serializable getKey()
-
getRole
public java.lang.String getRole()
-
getSnapshot
public java.io.Serializable getSnapshot()
-
resetStoredSnapshot
public void resetStoredSnapshot(PersistentCollection collection, java.io.Serializable storedSnapshot)
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
public CollectionPersister getCurrentPersister()
-
setCurrentPersister
public void setCurrentPersister(CollectionPersister currentPersister)
-
getCurrentKey
public java.io.Serializable getCurrentKey()
This is only available late during the flush cycle
-
setCurrentKey
public void setCurrentKey(java.io.Serializable currentKey)
-
getLoadedPersister
public CollectionPersister getLoadedPersister()
This is only available late during the flush cycle
-
getLoadedKey
public java.io.Serializable getLoadedKey()
-
setRole
public void setRole(java.lang.String role)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getOrphans
public java.util.Collection getOrphans(java.lang.String entityName, PersistentCollection collection) throws HibernateExceptionGet the collection orphans (entities which were removed from the collection)- Throws:
HibernateException
-
isSnapshotEmpty
public boolean isSnapshotEmpty(PersistentCollection collection)
-
serialize
public void serialize(java.io.ObjectOutputStream oos) throws java.io.IOExceptionCustom 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:
java.io.IOException
-
deserialize
public static CollectionEntry deserialize(java.io.ObjectInputStream ois, SessionImplementor session) throws java.io.IOException, java.lang.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:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
-