3.10.4. Entity Log
This mechanism tracks entity persistence at the entity listeners level, i.e. it is guaranteed to track all changes passing through persistent context of the EntityManager. Direct changes to entities in the database using SQL, including the ones performed using NativeQuery or QueryRunner, are not tracked.
Modified entity instances are passed to registerCreate()
, registerModify()
and registerDelete()
methods of the EntityLogAPI
bean before they are saved to the database. Each method has auto
parameter, allowing separation of automatic logs added by entity listeners from manual logs added by calling these methods from the application code. When these methods are called from entity listeners the value of auto
parameter is true
.
The logs contain information about the time of modification, the user who has modified the entity, and the new values of the changed attributes. Log entries are stored in the SEC_ENTITY_LOG table corresponding to the EntityLogItem
entity. Changed attribute values are stored in the CHANGES column and are converted to instances of EntityLogAttr
entity when they are loaded by the Middleware.