2.17.2: 2011-06-17

net.sf.basedb.core
Class LogControl

java.lang.Object
  extended by 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: 2010-08-13 10:50:27 +0200 (Fri, 13 Aug 2010) $

Field Summary
private  WeakReference<DbControl> dc
           
private  org.hibernate.StatelessSession session
           
private  TransactionDetails transactionDetails
           
 
Constructor Summary
LogControl(DbControl dc)
           
 
Method Summary
 org.hibernate.Query createHqlQuery(String hql)
          Creates a Hibernate HQL query.
 org.hibernate.Query createSqlQuery(String sql)
          Creates a Hibernate SQL query.
private  org.hibernate.StatelessSession getSession()
           
 TransactionDetails getTransactionDetails()
          Get information about the current transaction.
 void log(ChangeHistoryData history)
          Add a main entry the change history table.
 void log(ChangeHistoryDetailData detail)
          Adds information about a modified entity to the change history table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dc

private final WeakReference<DbControl> dc

transactionDetails

private TransactionDetails transactionDetails

session

private org.hibernate.StatelessSession session
Constructor Detail

LogControl

LogControl(DbControl dc)
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.

Parameters:
detail - A fully initialized ChangeHistoryDetailData object including a link to ChangeHistoryData that has been logged with log(ChangeHistoryData)

createHqlQuery

public org.hibernate.Query createHqlQuery(String hql)
Creates a Hibernate HQL query. 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

createSqlQuery

public org.hibernate.Query createSqlQuery(String sql)
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

getSession

private org.hibernate.StatelessSession getSession()

2.17.2: 2011-06-17