Class LoggingInterceptor

java.lang.Object
org.hibernate.EmptyInterceptor
net.sf.basedb.core.log.LoggingInterceptor
All Implemented Interfaces:
Serializable, Interceptor

public class LoggingInterceptor extends EmptyInterceptor
Interceptor that attaches to Hibernate sessions to provide logging of items that are updated/created/deleted. Do not attach this interceptor to a SessionFactory since this class is not thread-safe.

The interceptor uses onSave, onDelete and onFlushDirty to collect information about what has happened. The LogManagerFactory is asked to create EntityLogger:s for each modified/created/deleted item. The actual logging takes place in the postFlush method that calls EntityLogger.logChanges(LogManager, EntityDetails) on each entity logger.

NOTE! For new items, the ID is not available until after the flush to the database has been done. Eg. new items has a 0 id when LogManagerFactory.getEntityLogger(LogManager, Object) is called.

Version:
2.13
Author:
Nicklas
See Also:
Last modified
$Date: 2016-04-21 13:13:30 +0200 (to, 21 apr 2016) $