org.sqlproc.engine
Interface SqlMonitor

All Known Implementing Classes:
SqlEmptyMonitor

public interface SqlMonitor

The vehicle interface definition, which can be used to monitor the duration of all SQL queries execution.

The implementation can be based for example on the Javasimon library. Standard implementation is an empty one, which just delegates the execution to the runner, for example

 public <E> List<E> runQuery(Runner runner, Class<E> resultClass) {
     return (List<E>) runner.run();
 }
 

For more info please see the User's tutorial.

Author:
Vladimir Hudec

Nested Class Summary
static interface SqlMonitor.Runner
          This interface is implemented in SqlEngine main public methods.
 
Method Summary
 java.lang.String runGetSql(SqlMonitor.Runner runner)
          The SQLMonitor visitor method called from inside the SqlEngine.getSql(Object, Object, SqlOrder).
<E> java.util.List<E>
runQuery(SqlMonitor.Runner runner, java.lang.Class<E> resultClass)
          The SQLMonitor visitor method called from inside the SqlEngine.query(org.hibernate.Session, Class, Object, Object, SqlOrder, int, int, int).
 int runQueryCount(SqlMonitor.Runner runner)
          The SQLMonitor visitor method called from inside the SqlEngine.queryCount(org.hibernate.Session, Object, Object, SqlOrder, int).
 

Method Detail

runQuery

<E> java.util.List<E> runQuery(SqlMonitor.Runner runner,
                               java.lang.Class<E> resultClass)
The SQLMonitor visitor method called from inside the SqlEngine.query(org.hibernate.Session, Class, Object, Object, SqlOrder, int, int, int).

Parameters:
runner - the anonymous instance of SqlMonitor.Runner, which encapsulates the query execution
resultClass - the class used for the return values of the query execution
Returns:
the list of the resultClass instances

runQueryCount

int runQueryCount(SqlMonitor.Runner runner)
The SQLMonitor visitor method called from inside the SqlEngine.queryCount(org.hibernate.Session, Object, Object, SqlOrder, int).

Parameters:
runner - the anonymous instance of SqlMonitor.Runner, which encapsulates the queryCount execution
Returns:
the size of potential list of resultClass instances

runGetSql

java.lang.String runGetSql(SqlMonitor.Runner runner)
The SQLMonitor visitor method called from inside the SqlEngine.getSql(Object, Object, SqlOrder).

Parameters:
runner - the anonymous instance of SqlMonitor.Runner, which encapsulates the getSql execution
Returns:
the SQL query command derived from the META SQL based in input parameters


Copyright © 2010. All Rights Reserved.