Class 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: 2018-11-06 15:50:29 +0100 (ti, 06 nov 2018) $
    • Constructor Detail

    • Method Detail

      • 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> org.hibernate.query.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 org.hibernate.query.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> org.hibernate.query.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 org.hibernate.StatelessSession getSession()