public interface

Statistics

org.hibernate.stat.Statistics
Known Indirect Subclasses

Class Overview

Statistics for a particular SessionFactory. Beware of milliseconds metrics, they are depdendent of the JVM precision: you may then encounter a 10 ms approximation dending on you OS platform. Please refer to the JVM documentation for more information.

Summary

Public Methods
abstract void clear()
reset all statistics
abstract long getCloseStatementCount()
The number of prepared statements that were released
abstract long getCollectionFetchCount()
Global number of collections fetched
abstract long getCollectionLoadCount()
Global number of collections loaded
abstract long getCollectionRecreateCount()
Global number of collections recreated
abstract long getCollectionRemoveCount()
Global number of collections removed
abstract String[] getCollectionRoleNames()
Get the names of all collection roles
abstract CollectionStatistics getCollectionStatistics(String role)
Get collection statistics per role
abstract long getCollectionUpdateCount()
Global number of collections updated
abstract long getConnectCount()
Get the global number of connections asked by the sessions (the actual number of connections used may be much smaller depending whether you use a connection pool or not)
abstract long getEntityDeleteCount()
Get global number of entity deletes
abstract long getEntityFetchCount()
Get global number of entity fetchs
abstract long getEntityInsertCount()
Get global number of entity inserts
abstract long getEntityLoadCount()
Get global number of entity loads
abstract String[] getEntityNames()
Get the names of all entities
abstract EntityStatistics getEntityStatistics(String entityName)
find entity statistics per name
abstract long getEntityUpdateCount()
Get global number of entity updates
abstract long getFlushCount()
Get the global number of flush executed by sessions (either implicit or explicit)
abstract long getOptimisticFailureCount()
The number of StaleObjectStateExceptions that occurred
abstract long getPrepareStatementCount()
The number of prepared statements that were acquired
abstract String[] getQueries()
Get all executed query strings
abstract long getQueryCacheHitCount()
Get the global number of cached queries successfully retrieved from cache
abstract long getQueryCacheMissCount()
Get the global number of cached queries *not* found in cache
abstract long getQueryCachePutCount()
Get the global number of cacheable queries put in cache
abstract long getQueryExecutionCount()
Get global number of executed queries
abstract long getQueryExecutionMaxTime()
Get the time in milliseconds of the slowest query.
abstract String getQueryExecutionMaxTimeQueryString()
Get the query string for the slowest query.
abstract QueryStatistics getQueryStatistics(String queryString)
Query statistics from query string (HQL or SQL)
abstract long getSecondLevelCacheHitCount()
Global number of cacheable entities/collections successfully retrieved from the cache
abstract long getSecondLevelCacheMissCount()
Global number of cacheable entities/collections not found in the cache and loaded from the database.
abstract long getSecondLevelCachePutCount()
Global number of cacheable entities/collections put in the cache
abstract String[] getSecondLevelCacheRegionNames()
Get all second-level cache region names
abstract SecondLevelCacheStatistics getSecondLevelCacheStatistics(String regionName)
Second level cache statistics per region
abstract long getSessionCloseCount()
Global number of sessions closed
abstract long getSessionOpenCount()
Global number of sessions opened
abstract long getStartTime()
abstract long getSuccessfulTransactionCount()
The number of transactions we know to have been successful
abstract long getTransactionCount()
The number of transactions we know to have completed
abstract boolean isStatisticsEnabled()
Are statistics logged
abstract void logSummary()
log in info level the main statistics
abstract void setStatisticsEnabled(boolean b)
Enable statistics logs (this is a dynamic parameter)

Public Methods

public abstract void clear ()

reset all statistics

public abstract long getCloseStatementCount ()

The number of prepared statements that were released

public abstract long getCollectionFetchCount ()

Global number of collections fetched

public abstract long getCollectionLoadCount ()

Global number of collections loaded

public abstract long getCollectionRecreateCount ()

Global number of collections recreated

public abstract long getCollectionRemoveCount ()

Global number of collections removed

public abstract String[] getCollectionRoleNames ()

Get the names of all collection roles

public abstract CollectionStatistics getCollectionStatistics (String role)

Get collection statistics per role

Parameters
role collection role
Returns
  • CollectionStatistics

public abstract long getCollectionUpdateCount ()

Global number of collections updated

public abstract long getConnectCount ()

Get the global number of connections asked by the sessions (the actual number of connections used may be much smaller depending whether you use a connection pool or not)

public abstract long getEntityDeleteCount ()

Get global number of entity deletes

Returns
  • entity deletion count

public abstract long getEntityFetchCount ()

Get global number of entity fetchs

Returns
  • entity fetch (from DB)

public abstract long getEntityInsertCount ()

Get global number of entity inserts

Returns
  • entity insertion count

public abstract long getEntityLoadCount ()

Get global number of entity loads

Returns
  • entity load (from DB)

public abstract String[] getEntityNames ()

Get the names of all entities

public abstract EntityStatistics getEntityStatistics (String entityName)

find entity statistics per name

Parameters
entityName entity name
Returns
  • EntityStatistics object

public abstract long getEntityUpdateCount ()

Get global number of entity updates

Returns
  • entity update

public abstract long getFlushCount ()

Get the global number of flush executed by sessions (either implicit or explicit)

public abstract long getOptimisticFailureCount ()

The number of StaleObjectStateExceptions that occurred

public abstract long getPrepareStatementCount ()

The number of prepared statements that were acquired

public abstract String[] getQueries ()

Get all executed query strings

public abstract long getQueryCacheHitCount ()

Get the global number of cached queries successfully retrieved from cache

public abstract long getQueryCacheMissCount ()

Get the global number of cached queries *not* found in cache

public abstract long getQueryCachePutCount ()

Get the global number of cacheable queries put in cache

public abstract long getQueryExecutionCount ()

Get global number of executed queries

Returns
  • query execution count

public abstract long getQueryExecutionMaxTime ()

Get the time in milliseconds of the slowest query.

public abstract String getQueryExecutionMaxTimeQueryString ()

Get the query string for the slowest query.

public abstract QueryStatistics getQueryStatistics (String queryString)

Query statistics from query string (HQL or SQL)

Parameters
queryString query string
Returns
  • QueryStatistics

public abstract long getSecondLevelCacheHitCount ()

Global number of cacheable entities/collections successfully retrieved from the cache

public abstract long getSecondLevelCacheMissCount ()

Global number of cacheable entities/collections not found in the cache and loaded from the database.

public abstract long getSecondLevelCachePutCount ()

Global number of cacheable entities/collections put in the cache

public abstract String[] getSecondLevelCacheRegionNames ()

Get all second-level cache region names

public abstract SecondLevelCacheStatistics getSecondLevelCacheStatistics (String regionName)

Second level cache statistics per region

Parameters
regionName region name
Returns
  • SecondLevelCacheStatistics

public abstract long getSessionCloseCount ()

Global number of sessions closed

public abstract long getSessionOpenCount ()

Global number of sessions opened

public abstract long getStartTime ()

Returns

public abstract long getSuccessfulTransactionCount ()

The number of transactions we know to have been successful

public abstract long getTransactionCount ()

The number of transactions we know to have completed

public abstract boolean isStatisticsEnabled ()

Are statistics logged

public abstract void logSummary ()

log in info level the main statistics

public abstract void setStatisticsEnabled (boolean b)

Enable statistics logs (this is a dynamic parameter)