Add hql execution to Statistics
This commit is contained in:
parent
e62b3710a8
commit
d43b9940b9
|
@ -102,11 +102,6 @@ public class QueryOptionsImpl implements MutableQueryOptions, AppliedGraph {
|
|||
return limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasQueryExecutionToBeAddedToStatistics() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LockOptions getLockOptions() {
|
||||
return lockOptions;
|
||||
|
|
|
@ -161,15 +161,6 @@ public interface QueryOptions {
|
|||
return explicit != null ? explicit : Limit.NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the query execution has to be considered by the {@link org.hibernate.stat.Statistics}.
|
||||
*
|
||||
* @return true if the query execution has to be added to the {@link org.hibernate.stat.Statistics}, false otherwise.
|
||||
*/
|
||||
default boolean hasQueryExecutionToBeAddedToStatistics() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Did the application explicitly request paging limits?
|
||||
*
|
||||
|
|
|
@ -858,4 +858,10 @@ public class QuerySqmImpl<R>
|
|||
getHints()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasQueryExecutionToBeAddedToStatistics() {
|
||||
return !CRITERIA_HQL_STRING.equals( hqlString );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@ public class JdbcSelectExecutorStandardImpl implements JdbcSelectExecutor {
|
|||
final boolean stats;
|
||||
long startTime = 0;
|
||||
final StatisticsImplementor statistics = executionContext.getSession().getFactory().getStatistics();
|
||||
if ( executionContext.getQueryOptions().hasQueryExecutionToBeAddedToStatistics()
|
||||
if ( executionContext.hasQueryExecutionToBeAddedToStatistics()
|
||||
&& jdbcValues instanceof JdbcValuesResultSetImpl ) {
|
||||
stats = statistics.isStatisticsEnabled();
|
||||
if ( stats ) {
|
||||
|
|
|
@ -74,4 +74,14 @@ public interface ExecutionContext {
|
|||
default void afterStatement(LogicalConnectionImplementor logicalConnection) {
|
||||
logicalConnection.afterStatement();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the query execution has to be considered by the {@link org.hibernate.stat.Statistics}.
|
||||
*
|
||||
* @return true if the query execution has to be added to the {@link org.hibernate.stat.Statistics}, false otherwise.
|
||||
*/
|
||||
default boolean hasQueryExecutionToBeAddedToStatistics() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue