org.hibernate.engine.spi
Class CollectionEntry

java.lang.Object
  extended by org.hibernate.engine.spi.CollectionEntry
All Implemented Interfaces:
Serializable

public final class CollectionEntry
extends Object
implements Serializable

We 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
CollectionEntry(CollectionPersister persister, PersistentCollection collection)
          For newly wrapped collections, or dereferenced collection wrappers
CollectionEntry(CollectionPersister loadedPersister, Serializable loadedKey)
          For uninitialized detached collections
CollectionEntry(PersistentCollection collection, CollectionPersister loadedPersister, Serializable loadedKey, boolean ignore)
          For collections just loaded from the database
CollectionEntry(PersistentCollection collection, SessionFactoryImplementor factory)
          For initialized detached collections
 
Method Summary
 void afterAction(PersistentCollection collection)
          Called after execution of an action
static CollectionEntry deserialize(ObjectInputStream ois, SessionImplementor session)
          Custom deserialization routine used during deserialization of a Session/PersistenceContext for increased performance.
 Serializable getCurrentKey()
          This is only available late during the flush cycle
 CollectionPersister getCurrentPersister()
           
 Serializable getKey()
           
 Serializable getLoadedKey()
           
 CollectionPersister getLoadedPersister()
          This is only available late during the flush cycle
 Collection getOrphans(String entityName, PersistentCollection collection)
          Get the collection orphans (entities which were removed from the collection)
 String getRole()
           
 Serializable getSnapshot()
           
 boolean isDorecreate()
           
 boolean isDoremove()
           
 boolean isDoupdate()
           
 boolean isIgnore()
           
 boolean isProcessed()
           
 boolean isReached()
           
 boolean isSnapshotEmpty(PersistentCollection collection)
           
 void postFlush(PersistentCollection collection)
          Called after a successful flush
 void postInitialize(PersistentCollection collection)
           
 void preFlush(PersistentCollection collection)
           
 void serialize(ObjectOutputStream oos)
          Custom serialization routine used during serialization of a Session/PersistenceContext for increased performance.
 void setCurrentKey(Serializable currentKey)
           
 void setCurrentPersister(CollectionPersister currentPersister)
           
 void setDorecreate(boolean dorecreate)
           
 void setDoremove(boolean doremove)
           
 void setDoupdate(boolean doupdate)
           
 void setProcessed(boolean processed)
           
 void setReached(boolean reached)
           
 void setRole(String role)
           
 String toString()
           
 boolean wasDereferenced()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CollectionEntry

public CollectionEntry(CollectionPersister persister,
                       PersistentCollection collection)
For newly wrapped collections, or dereferenced collection wrappers


CollectionEntry

public CollectionEntry(PersistentCollection collection,
                       CollectionPersister loadedPersister,
                       Serializable loadedKey,
                       boolean ignore)
For collections just loaded from the database


CollectionEntry

public CollectionEntry(CollectionPersister loadedPersister,
                       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 Serializable getKey()

getRole

public String getRole()

getSnapshot

public Serializable getSnapshot()

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 Serializable getCurrentKey()
This is only available late during the flush cycle


setCurrentKey

public void setCurrentKey(Serializable currentKey)

getLoadedPersister

public CollectionPersister getLoadedPersister()
This is only available late during the flush cycle


getLoadedKey

public Serializable getLoadedKey()

setRole

public void setRole(String role)

toString

public String toString()
Overrides:
toString in class Object

getOrphans

public Collection getOrphans(String entityName,
                             PersistentCollection collection)
                      throws HibernateException
Get the collection orphans (entities which were removed from the collection)

Throws:
HibernateException

isSnapshotEmpty

public boolean isSnapshotEmpty(PersistentCollection collection)

serialize

public void serialize(ObjectOutputStream oos)
               throws IOException
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


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.