3.4.8.1. Configuration
Annotate Persistent Entity Any persistence entity can be enabled for audit by annotating with org.apache.openjpa.audit.Auditable.
@jakarta.persistence.Entity
@org.apache.openjpa.audit.Auditable
public class MyDomainObject { ...}
This Auditable annotation enables auditing of creation, update or delete of MyDomainObject instances.
The Auditable annotation accepts list of enumerated values org.apache.openjpa.audit.AuditableOperation namely CREATE, UPDATE and DELETE to customize only appropriate operations be audited.
By deafult, all of the above operations are audited.
Configure Persistence Configuration The audit facility is invoked at runtime via configuration of META-INF/persistence.xml.
The following property configures auditing via a default auditor
<property name="openjpa.Auditor" value="default"/>
The default auditor does not do much. It simply prints each auditable instance with its latest and original states on a standard console (or to a designated file).
The latest state of an instance designates the state which is commited to the database. The originalstate designates the state when the instance entered the managed persistent context. For example, when a new instance is persisted or a existing instance is loaded from the database.