Top Description Fields Constructors Methods
org.hibernate.event.spi

public abstract Class AbstractCollectionEvent

extends AbstractEvent
Class Inheritance
Known Direct Subclasses
org.hibernate.event.spi.InitializeCollectionEvent, org.hibernate.event.spi.PostCollectionRecreateEvent, org.hibernate.event.spi.PostCollectionRemoveEvent, org.hibernate.event.spi.PostCollectionUpdateEvent, org.hibernate.event.spi.PreCollectionRecreateEvent, org.hibernate.event.spi.PreCollectionRemoveEvent, org.hibernate.event.spi.PreCollectionUpdateEvent
Imports
org.hibernate.collection.spi.PersistentCollection, org.hibernate.engine.spi.CollectionEntry, .EntityEntry, org.hibernate.persister.collection.CollectionPersister

Defines a base class for events involving collections.
Author
Gail Badner

Field Summary

Modifier and TypeField and Description
private final Object
private final String
private final Object
private final PersistentCollection<?>

Constructor Summary

AccessConstructor and Description
public
AbstractCollectionEvent(CollectionPersister collectionPersister, PersistentCollection<?>
- the collection
collection
,
EventSource
- the Session source
source
,
Object
- the owner that is affected by this event; can be null if unavailable
affectedOwner
,
Object
- the ID for the owner that is affected by this event; can be null if unavailable
affectedOwnerId
)

Constructs an AbstractCollectionEvent object.

Method Summary

Modifier and TypeMethod and Description
protected static String
getAffectedOwnerEntityName(CollectionPersister collectionPersister, Object affectedOwner, EventSource source)

public String

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
getAffectedOwnerEntityName
()

Get the entity name for the collection owner entity that is affected by this event.

public Object

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)
getAffectedOwnerIdOrNull
()

Get the ID for the collection owner entity that is affected by this event.

public Object

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)
getAffectedOwnerOrNull
()

Get the collection owner entity that is affected by this event.

public PersistentCollection<?>
protected static CollectionPersister
protected static Object
protected static Object
protected static Object
Inherited from org.hibernate.event.spi.AbstractEvent:
getSession

Field Detail

affectedOwnerback to summary
private final Object affectedOwner
affectedOwnerEntityNameback to summary
private final String affectedOwnerEntityName
affectedOwnerIdback to summary
private final Object affectedOwnerId
collectionback to summary
private final PersistentCollection<?> collection

Constructor Detail

AbstractCollectionEventback to summary
public AbstractCollectionEvent(CollectionPersister collectionPersister, PersistentCollection<?> collection, EventSource source, Object affectedOwner, Object affectedOwnerId)

Constructs an AbstractCollectionEvent object.

Parameters
collection:PersistentCollection<?>

- the collection

source:EventSource

- the Session source

affectedOwner:Object

- the owner that is affected by this event; can be null if unavailable

affectedOwnerId:Object

- the ID for the owner that is affected by this event; can be null if unavailable

Method Detail

getAffectedOwnerEntityNameback to summary
protected static String getAffectedOwnerEntityName(CollectionPersister collectionPersister, Object affectedOwner, EventSource source)
getAffectedOwnerEntityNameback to summary
public String getAffectedOwnerEntityName()

Get the entity name for the collection owner entity that is affected by this event.

Returns:String

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

getAffectedOwnerIdOrNullback to summary
public Object getAffectedOwnerIdOrNull()

Get the ID for the collection owner entity that is affected by this event.

Returns:Object

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)

getAffectedOwnerOrNullback to summary
public Object getAffectedOwnerOrNull()

Get the collection owner entity that is affected by this event.

Returns:Object

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)

getCollectionback to summary
public PersistentCollection<?> getCollection()
getLoadedCollectionPersisterback to summary
protected static CollectionPersister getLoadedCollectionPersister(PersistentCollection<?> collection, EventSource source)
getLoadedOwnerIdOrNullback to summary
protected static Object getLoadedOwnerIdOrNull(PersistentCollection<?> collection, EventSource source)
getLoadedOwnerOrNullback to summary
protected static Object getLoadedOwnerOrNull(PersistentCollection<?> collection, EventSource source)
getOwnerIdOrNullback to summary
protected static Object getOwnerIdOrNull(Object owner, EventSource source)