Class AuditLogFactory

java.lang.Object
org.hibernate.audit.AuditLogFactory

public final class AuditLogFactory extends Object
Factory for obtaining AuditLog instances.

Two creation modes are supported:

The returned AuditLog is AutoCloseable and should be closed by the caller to release the internal session. For connection-sharing instances, the audit log is also automatically closed when the parent session closes.
Since:
7.4
See Also:
  • Method Details

    • create

      public static AuditLog create(SessionFactory sessionFactory)
      Create a standalone audit log.
      Parameters:
      sessionFactory - the session factory
      Returns:
      a new audit log (must be closed by the caller)
    • create

      public static AuditLog create(EntityManagerFactory entityManagerFactory)
      Create a standalone audit log.
      Parameters:
      entityManagerFactory - the entity manager factory
      Returns:
      a new audit log (must be closed by the caller)
    • create

      public static AuditLog create(Session session)
      Create an audit log sharing the session's JDBC connection.
      Parameters:
      session - the session whose connection to share
      Returns:
      a new audit log (must be closed by the caller)
    • create

      public static AuditLog create(StatelessSession session)
      Create an audit log sharing the stateless session's JDBC connection.
      Parameters:
      session - the stateless session whose connection to share
      Returns:
      a new audit log (must be closed by the caller)
    • create

      public static AuditLog create(EntityManager entityManager)
      Create an audit log sharing the entity manager's JDBC connection.
      Parameters:
      entityManager - the entity manager whose connection to share
      Returns:
      a new audit log (must be closed by the caller)