org.hibernate.event
Class AbstractCollectionEvent
- Serializable
public abstract class AbstractCollectionEvent
Defines a base class for events involving collections.
AbstractCollectionEvent
public AbstractCollectionEvent(CollectionPersister collectionPersister,
PersistentCollection collection,
EventSource source,
Object affectedOwner,
Serializable affectedOwnerId)
Constructs an AbstractCollectionEvent object.
collection
- - the collectionsource
- - the Session sourceaffectedOwner
- - the owner that is affected by this event;
can be null if unavailableaffectedOwnerId
- - the ID for the owner that is affected
by this event; can be null if unavailable
that is affected by this event; can be null if unavailable
getAffectedOwnerEntityName
public String getAffectedOwnerEntityName()
Get the entity name for the collection owner entity that is affected by this event.
- the entity name; if the owner is not in the PersistenceContext, the
returned value may be a superclass name, instead of the actual class name
getAffectedOwnerEntityName
protected static String getAffectedOwnerEntityName(CollectionPersister collectionPersister,
Object affectedOwner,
EventSource source)
getAffectedOwnerIdOrNull
public Serializable getAffectedOwnerIdOrNull()
Get the ID for the collection owner entity that is affected by this event.
- the affected owner ID; returns null if the ID cannot be obtained
from the collection's loaded key (e.g., a property-ref is used for the
collection and does not include the entity's ID)
getAffectedOwnerOrNull
public Object getAffectedOwnerOrNull()
Get the collection owner entity that is affected by this event.
- the affected owner; returns null if the entity is not in the persistence context
(e.g., because the collection from a detached entity was moved to a new owner)
getOwnerIdOrNull
protected static Serializable getOwnerIdOrNull(Object owner,
EventSource source)