Package org.hibernate.event.spi
Class AbstractCollectionEvent
java.lang.Object
org.hibernate.event.spi.AbstractEvent
org.hibernate.event.spi.AbstractCollectionEvent
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
InitializeCollectionEvent
,PostCollectionRecreateEvent
,PostCollectionRemoveEvent
,PostCollectionUpdateEvent
,PreCollectionRecreateEvent
,PreCollectionRemoveEvent
,PreCollectionUpdateEvent
Defines a base class for events involving collections.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractCollectionEvent
(CollectionPersister collectionPersister, PersistentCollection<?> collection, EventSource source, Object affectedOwner, Object affectedOwnerId) Constructs an AbstractCollectionEvent object. -
Method Summary
Modifier and TypeMethodDescriptionGet the entity name for the collection owner entity that is affected by this event.protected static String
getAffectedOwnerEntityName
(CollectionPersister collectionPersister, Object affectedOwner, EventSource source) Get the ID for the collection owner entity that is affected by this event.Get the collection owner entity that is affected by this event.protected static CollectionPersister
getLoadedCollectionPersister
(PersistentCollection<?> collection, EventSource source) protected static Object
getLoadedOwnerIdOrNull
(PersistentCollection<?> collection, EventSource source) protected static Object
getLoadedOwnerOrNull
(PersistentCollection<?> collection, EventSource source) protected static Object
getOwnerIdOrNull
(Object owner, EventSource source) Methods inherited from class org.hibernate.event.spi.AbstractEvent
getFactory, getSession
-
Constructor Details
-
AbstractCollectionEvent
public AbstractCollectionEvent(CollectionPersister collectionPersister, PersistentCollection<?> collection, EventSource source, Object affectedOwner, Object affectedOwnerId) Constructs an AbstractCollectionEvent object.- Parameters:
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
-
-
Method Details
-
getLoadedCollectionPersister
protected static CollectionPersister getLoadedCollectionPersister(PersistentCollection<?> collection, EventSource source) -
getLoadedOwnerOrNull
protected static Object getLoadedOwnerOrNull(PersistentCollection<?> collection, EventSource source) -
getLoadedOwnerIdOrNull
protected static Object getLoadedOwnerIdOrNull(PersistentCollection<?> collection, EventSource source) -
getOwnerIdOrNull
-
getAffectedOwnerEntityName
protected static String getAffectedOwnerEntityName(CollectionPersister collectionPersister, Object affectedOwner, EventSource source) -
getCollection
-
getAffectedOwnerOrNull
Get the collection owner entity that is affected by this event.- Returns:
- 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)
-
getAffectedOwnerIdOrNull
Get the ID for the collection owner entity that is affected by this event.- Returns:
- 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)
-
getAffectedOwnerEntityName
Get the entity name for the collection owner entity that is affected by this event.- Returns:
- 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
-