Top Description Methods
org.hibernate.stat

public Interface Statistics

Known Direct Subinterfaces
org.hibernate.jmx.StatisticsServiceMBean
Known Direct Implementers
org.hibernate.stat.StatisticsImpl, org.hibernate.stat.ConcurrentStatisticsImpl

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.
Author
Emmanuel Bernard

Method Summary

Modifier and TypeMethod and Description
public void
clear()

reset all statistics

public long
getCloseStatementCount()

The number of prepared statements that were released

public long
getCollectionFetchCount()

Global number of collections fetched

public long
getCollectionLoadCount()

Global number of collections loaded

public long
getCollectionRecreateCount()

Global number of collections recreated

public long
getCollectionRemoveCount()

Global number of collections removed

public String[]
getCollectionRoleNames()

Get the names of all collection roles

public CollectionStatistics

Returns:

CollectionStatistics
getCollectionStatistics
(String
collection role
role
)

Get collection statistics per role

public long
getCollectionUpdateCount()

Global number of collections updated

public 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 long

Returns:

entity deletion count
getEntityDeleteCount
()

Get global number of entity deletes

public long

Returns:

entity fetch (from DB)
getEntityFetchCount
()

Get global number of entity fetchs

public long

Returns:

entity insertion count
getEntityInsertCount
()

Get global number of entity inserts

public long

Returns:

entity load (from DB)
getEntityLoadCount
()

Get global number of entity loads

public String[]
getEntityNames()

Get the names of all entities

public EntityStatistics

Returns:

EntityStatistics object
getEntityStatistics
(String
entity name
entityName
)

find entity statistics per name

public long

Returns:

entity update
getEntityUpdateCount
()

Get global number of entity updates

public long
getFlushCount()

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

public long
getOptimisticFailureCount()

The number of StaleObjectStateExceptions that occurred

public long
getPrepareStatementCount()

The number of prepared statements that were acquired

public String[]
getQueries()

Get all executed query strings

public long
getQueryCacheHitCount()

Get the global number of cached queries successfully retrieved from cache

public long
getQueryCacheMissCount()

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

public long
getQueryCachePutCount()

Get the global number of cacheable queries put in cache

public long

Returns:

query execution count
getQueryExecutionCount
()

Get global number of executed queries

public long
getQueryExecutionMaxTime()

Get the time in milliseconds of the slowest query.

public String
getQueryExecutionMaxTimeQueryString()

Get the query string for the slowest query.

public QueryStatistics

Returns:

QueryStatistics
getQueryStatistics
(String
query string
queryString
)

Query statistics from query string (HQL or SQL)

public long
getSecondLevelCacheHitCount()

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

public long
getSecondLevelCacheMissCount()

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

public long
getSecondLevelCachePutCount()

Global number of cacheable entities/collections put in the cache

public String[]
getSecondLevelCacheRegionNames()

Get all second-level cache region names

public SecondLevelCacheStatistics

Returns:

SecondLevelCacheStatistics
getSecondLevelCacheStatistics
(String
region name
regionName
)

Second level cache statistics per region

public long
getSessionCloseCount()

Global number of sessions closed

public long
getSessionOpenCount()

Global number of sessions opened

public long

Returns:

start time in ms (JVM standards System#currentTimeMillis())
getStartTime
()

public long
getSuccessfulTransactionCount()

The number of transactions we know to have been successful

public long
getTransactionCount()

The number of transactions we know to have completed

public boolean
isStatisticsEnabled()

Are statistics logged

public void
logSummary()

log in info level the main statistics

public void
setStatisticsEnabled(boolean b)

Enable statistics logs (this is a dynamic parameter)

Method Detail

clearback to summary
public void clear()

reset all statistics

getCloseStatementCountback to summary
public long getCloseStatementCount()

The number of prepared statements that were released

getCollectionFetchCountback to summary
public long getCollectionFetchCount()

Global number of collections fetched

getCollectionLoadCountback to summary
public long getCollectionLoadCount()

Global number of collections loaded

getCollectionRecreateCountback to summary
public long getCollectionRecreateCount()

Global number of collections recreated

getCollectionRemoveCountback to summary
public long getCollectionRemoveCount()

Global number of collections removed

getCollectionRoleNamesback to summary
public String[] getCollectionRoleNames()

Get the names of all collection roles

getCollectionStatisticsback to summary
public CollectionStatistics getCollectionStatistics(String role)

Get collection statistics per role

Parameters
role:String

collection role

Returns:CollectionStatistics

CollectionStatistics

getCollectionUpdateCountback to summary
public long getCollectionUpdateCount()

Global number of collections updated

getConnectCountback to summary
public 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)

getEntityDeleteCountback to summary
public long getEntityDeleteCount()

Get global number of entity deletes

Returns:long

entity deletion count

getEntityFetchCountback to summary
public long getEntityFetchCount()

Get global number of entity fetchs

Returns:long

entity fetch (from DB)

getEntityInsertCountback to summary
public long getEntityInsertCount()

Get global number of entity inserts

Returns:long

entity insertion count

getEntityLoadCountback to summary
public long getEntityLoadCount()

Get global number of entity loads

Returns:long

entity load (from DB)

getEntityNamesback to summary
public String[] getEntityNames()

Get the names of all entities

getEntityStatisticsback to summary
public EntityStatistics getEntityStatistics(String entityName)

find entity statistics per name

Parameters
entityName:String

entity name

Returns:EntityStatistics

EntityStatistics object

getEntityUpdateCountback to summary
public long getEntityUpdateCount()

Get global number of entity updates

Returns:long

entity update

getFlushCountback to summary
public long getFlushCount()

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

getOptimisticFailureCountback to summary
public long getOptimisticFailureCount()

The number of StaleObjectStateExceptions that occurred

getPrepareStatementCountback to summary
public long getPrepareStatementCount()

The number of prepared statements that were acquired

getQueriesback to summary
public String[] getQueries()

Get all executed query strings

getQueryCacheHitCountback to summary
public long getQueryCacheHitCount()

Get the global number of cached queries successfully retrieved from cache

getQueryCacheMissCountback to summary
public long getQueryCacheMissCount()

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

getQueryCachePutCountback to summary
public long getQueryCachePutCount()

Get the global number of cacheable queries put in cache

getQueryExecutionCountback to summary
public long getQueryExecutionCount()

Get global number of executed queries

Returns:long

query execution count

getQueryExecutionMaxTimeback to summary
public long getQueryExecutionMaxTime()

Get the time in milliseconds of the slowest query.

getQueryExecutionMaxTimeQueryStringback to summary
public String getQueryExecutionMaxTimeQueryString()

Get the query string for the slowest query.

getQueryStatisticsback to summary
public QueryStatistics getQueryStatistics(String queryString)

Query statistics from query string (HQL or SQL)

Parameters
queryString:String

query string

Returns:QueryStatistics

QueryStatistics

getSecondLevelCacheHitCountback to summary
public long getSecondLevelCacheHitCount()

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

getSecondLevelCacheMissCountback to summary
public long getSecondLevelCacheMissCount()

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

getSecondLevelCachePutCountback to summary
public long getSecondLevelCachePutCount()

Global number of cacheable entities/collections put in the cache

getSecondLevelCacheRegionNamesback to summary
public String[] getSecondLevelCacheRegionNames()

Get all second-level cache region names

getSecondLevelCacheStatisticsback to summary
public SecondLevelCacheStatistics getSecondLevelCacheStatistics(String regionName)

Second level cache statistics per region

Parameters
regionName:String

region name

Returns:SecondLevelCacheStatistics

SecondLevelCacheStatistics

getSessionCloseCountback to summary
public long getSessionCloseCount()

Global number of sessions closed

getSessionOpenCountback to summary
public long getSessionOpenCount()

Global number of sessions opened

getStartTimeback to summary
public long getStartTime()
Returns:long

start time in ms (JVM standards System#currentTimeMillis())

getSuccessfulTransactionCountback to summary
public long getSuccessfulTransactionCount()

The number of transactions we know to have been successful

getTransactionCountback to summary
public long getTransactionCount()

The number of transactions we know to have completed

isStatisticsEnabledback to summary
public boolean isStatisticsEnabled()

Are statistics logged

logSummaryback to summary
public void logSummary()

log in info level the main statistics

setStatisticsEnabledback to summary
public void setStatisticsEnabled(boolean b)

Enable statistics logs (this is a dynamic parameter)