-
Notifications
You must be signed in to change notification settings - Fork 18
Plugin API
Martin Ledvinka edited this page Aug 18, 2025
·
1 revision
Since version 2.5.0, JOPA implementation provides a Plugin API so that client applications can add custom behavior to selected parts/events in JOPA.
The plugins must implement the corresponding interfaces declared in cz.cvut.kbss.jopa.plugin
and have public no-arg constructor so that JOPA can instantiate them. The plugin interfaces declare all methods with an empty default implementation, so the plugin only needs to override the methods it wants.
The plugins are registered by passing the fully qualified plugin class name to the persistence unit in properties as values of the relevant plugin property. For example:
final Map<String, String> props = // init common persistence configuration
props.put(JOPAPersistenceProperties.PERSISTENCE_UNIT_LIFECYCLE_PLUGINS, SampleLifecyclePlugin.class.getName());
// props.put("cz.cvut.jopa.plugin.persistenceUnit", cz.cvut.kbss.jopa.sample.SampleLifecyclePlugin");
Multiple plugins may be registered for a single property, just pass separate they fully qualified names with a comma.
-
PersistenceUnitLifecyclePlugin (
cz.cvut.jopa.plugin.persistenceUnit
)