Class LogControl

java.lang.Object
net.sf.basedb.core.LogControl

public class LogControl extends Object
Gives information about the current transaction and gives log implementations limited access to the database.
Version:
2.13
Author:
Nicklas
Last modified
$Date: 2021-05-07 13:30:22 +0200 (Fri, 07 May 2021) $
  • Field Details

  • Constructor Details

  • Method Details

    • getName

      public String getName()
      Get the name of this transaction.
      Since:
      3.19
    • getTransactionDetails

      public TransactionDetails getTransactionDetails()
      Get information about the current transaction.
      Returns:
      A TransactionDetails object
    • log

      public void log(ChangeHistoryData history)
      Add a main entry the change history table. Each transaction usually results in one such entry. Changes to individual entities are logged with log(ChangeHistoryDetailData).
      Parameters:
      history - A fully initialized ChangeHistoryData object
    • log

      public void log(ChangeHistoryDetailData detail)
      Adds information about a modified entity to the change history table. The details may not be sent to the database immediately but can be batched for more efficient use of resources.
      Parameters:
      detail - A fully initialized ChangeHistoryDetailData object including a link to ChangeHistoryData that has been logged with log(ChangeHistoryData)
    • createHqlQuery

      public <R> Query<R> createHqlQuery(String hql, Class<R> returnType)
      Creates a Hibernate HQL query with a known return type. Use this to get information from the database that is relevent for the logging implementation. The query uses the stateless session, which means that there is no first- or second-level cache and on support for initialization of proxies. We recommend that queries are used to return scalar values only, not entities.
      Returns:
      A Query
      Since:
      3.12
    • flush

      public void flush()
      Flushes any batched changes to the database.
    • createSqlQuery

      @Deprecated public Query<?> createSqlQuery(String sql)
      Deprecated.
      In 3.12. use createSqlQuery(String, Class) instead
      Creates a Hibernate SQL query. Use this to get information from the database that is relevent for the logging implementation. The query uses the stateless session.
      Returns:
      A query
    • createSqlQuery

      public <R> Query<R> createSqlQuery(String sql, Class<R> returnType)
      Creates a Hibernate SQL query with a known return type. Use this to get information from the database that is relevent for the logging implementation. The query uses the stateless session.
      Returns:
      A query
      Since:
      3.12
    • getSession

      private StatelessSession getSession()