Package net.sf.basedb.core
Class LogControl
java.lang.Object
net.sf.basedb.core.LogControl
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 Summary
Modifier and TypeFieldDescriptionprivate int
private final int
private final WeakReference<DbControl>
private PreparedStatement
private final String
private StatelessSession
private TransactionDetails
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<R> Query<R>
createHqlQuery
(String hql, Class<R> returnType) Creates a Hibernate HQL query with a known return type.Query<?>
createSqlQuery
(String sql) Deprecated.<R> Query<R>
createSqlQuery
(String sql, Class<R> returnType) Creates a Hibernate SQL query with a known return type.void
flush()
Flushes any batched changes to the database.getName()
Get the name of this transaction.private StatelessSession
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.
-
Field Details
-
dc
-
name
-
transactionDetails
-
session
-
insertIntoDetails
-
batchSize
private final int batchSize -
batchCount
private int batchCount
-
-
Constructor Details
-
LogControl
LogControl(DbControl dc)
-
-
Method Details
-
getName
Get the name of this transaction.- Since:
- 3.19
-
getTransactionDetails
Get information about the current transaction.- Returns:
- A TransactionDetails object
-
log
Add a main entry the change history table. Each transaction usually results in one such entry. Changes to individual entities are logged withlog(ChangeHistoryDetailData)
.- Parameters:
history
- A fully initialized ChangeHistoryData object
-
log
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 toChangeHistoryData
that has been logged withlog(ChangeHistoryData)
-
createHqlQuery
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.In 3.12. usecreateSqlQuery(String, Class)
insteadCreates 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
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
-
createSqlQuery(String, Class)
instead