Interface PersistenceEvents


public interface PersistenceEvents
A framework-wide event bus for entity persistence, keyed per EntityType.

Instances are static and shared per entity type (see persistenceEvents(EntityType)). The PersistenceEvents.Inserted, PersistenceEvents.Updated and PersistenceEvents.Deleted events extend Consumer, so any code - not just the editor - may publish persistence events.

The bus is shared by the whole JVM and knows nothing of connections: a listener hears the events of every editor in the JVM, whichever connection persisted the entities. This assumes one database per JVM, where two connections to it see each other's changes, as they should. Where one JVM connects to several databases with the same entity types, opt out on either side: an editor via EntityEditor.Settings.publishPersistenceEvents(), or EntityEditor.PUBLISH_PERSISTENCE_EVENTS for all, a model listening via its persistenceAware() builder option, see EntityComboBoxModel.PERSISTENCE_AWARE and EntitySearchModel.PERSISTENCE_AWARE.

See Also: