org.hibernate.SessionFactory .
Collection of statistics is enabled if the configuration property
hibernate.generate_statistics is
set to true. It may be dynamically enabled or disabled at
runtime by calling setStatisticsEnabled(boolean).
| Modifier and Type | Field and Description |
|---|---|
| public static final int | DEFAULT_QUERY_STATISTICS_MAX_SIZE
The default value of the configuration property hibernate.statistics.query_max_size. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public @Nullable CacheRegionStatistics | Returns: the statistics for the named region, ornull if
there is no region with the given nameThe unqualified region name regionName)Obtain the statistics for either a domain data or query result cache region. |
| public long | |
| public long | |
| public long | |
| public long | |
| public long | |
| public String[] | |
| public CollectionStatistics | getCollectionStatistics(String
the collection role role)Obtain the statistics for the collection with the given role. |
| public long | |
| public long | |
| public CacheRegionStatistics | Returns: the statistics for the named region, ornull
if the second-level cache is not enabledThe unqualified region name regionName)Obtain the second-level cache statistics for the given cache region. |
| public long | |
| public long | |
| public long | |
| public long | |
| public String[] | |
| public EntityStatistics | getEntityStatistics(String
the entity name entityName)Obtain the statistics for the entity with the given name. |
| public long | |
| public long | getFlushCount()
The global number of flush operations executed, including automatic (either manual or automatic). |
| public long | getNaturalIdCacheHitCount()
The global number of cached natural id lookups successfully retrieved from the cache. |
| public long | |
| public long | |
| public long | getNaturalIdQueryExecutionCount()
The global number of natural id queries executed against the database. |
| public long | getNaturalIdQueryExecutionMaxTime()
The global maximum query time for natural id queries executed against the database. |
| public @Nullable String | |
| public @Nullable String | |
| public NaturalIdStatistics | getNaturalIdStatistics(String
The entity name that is the root of the
hierarchy containing the natural id entityName)Obtain the natural id resolution statistics for the entity type with the given name. |
| public long | getOptimisticFailureCount()
The number of Hibernate |
| public long | |
| public String[] | |
| public long | |
| public long | |
| public long | |
| public long | |
| public long | |
| public @Nullable String | |
| public long | |
| public long | |
| public @Nullable CacheRegionStatistics | Returns: the statistics for the named region, ornull
if either query result caching is not enabled, or no
query cache region exists with the given nameThe unqualified region name regionName)Obtain the second-level cache statistics for the given query cache region. |
| public QueryStatistics | getQueryStatistics(String
the query string, written in HQL or SQL queryString)Obtain the query statistics for the given query string. |
| public long | getSecondLevelCacheHitCount()
The global number of cacheable entities and collections successfully retrieved from the cache. |
| public long | getSecondLevelCacheMissCount()
The global number of cacheable entities collections not found in the cache and loaded from the database. |
| public long | getSecondLevelCachePutCount()
The global number of cacheable entities and collections put in the cache. |
| public String[] | |
| public long | |
| public long | |
| public Map | getSlowQueries()
If hibernate.log_slow_query is enabled, a map from the SQL query to the maximum execution time in milliseconds. |
| public Instant | |
| public long | getStartTime()
Deprecated
since 6.0. use
The Instant#toEpochMilli() milliseconds since the
initial creation of this instance, or since the last time
getStart()
clear() was called.
|
| public long | |
| public long | |
| public long | getUpdateTimestampsCacheHitCount()
The global number of timestamps successfully retrieved from cache. |
| public long | getUpdateTimestampsCacheMissCount()
The global number of timestamp requests that were not found in the cache. |
| public long | |
| public boolean | |
| public void | |
| public void |
| DEFAULT_QUERY_STATISTICS_MAX_SIZE | back to summary |
|---|---|
| public static final int DEFAULT_QUERY_STATISTICS_MAX_SIZE The default value of the configuration property hibernate.statistics.query_max_size. | |
| clear | back to summary |
|---|---|
| public void clear() Reset all statistics. | |
| getCacheRegionStatistics | back to summary |
|---|---|
| public @Nullable CacheRegionStatistics getCacheRegionStatistics(String regionName) Obtain the statistics for either a domain data or query result cache region. This method checks both, preferring the domain data region if there is one. Think of it as a cascading check to: Note that null is returned instead of throwing an exception when no region exists with the given name.
| |
| getCloseStatementCount | back to summary |
|---|---|
| public long getCloseStatementCount() The number of prepared statements that were released. | |
| getCollectionFetchCount | back to summary |
|---|---|
| public long getCollectionFetchCount() The global number of collections fetched. | |
| getCollectionLoadCount | back to summary |
|---|---|
| public long getCollectionLoadCount() The global number of collections loaded. | |
| getCollectionRecreateCount | back to summary |
|---|---|
| public long getCollectionRecreateCount() The global number of collections recreated | |
| getCollectionRemoveCount | back to summary |
|---|---|
| public long getCollectionRemoveCount() The global number of collections removed. | |
| getCollectionRoleNames | back to summary |
|---|---|
| public String[] getCollectionRoleNames() The names of all collection roles. | |
| getCollectionStatistics | back to summary |
|---|---|
| public CollectionStatistics getCollectionStatistics(String role) Obtain the statistics for the collection with the given role.
| |
| getCollectionUpdateCount | back to summary |
|---|---|
| public long getCollectionUpdateCount() The global number of collections updated. | |
| getConnectCount | back to summary |
|---|---|
| public long getConnectCount() The global number of connections requested by sessions. The actual number of connections used may be much smaller, assuming that a connection pool is in use. | |
| getDomainDataRegionStatistics | back to summary |
|---|---|
| public CacheRegionStatistics getDomainDataRegionStatistics(String regionName) Obtain the second-level cache statistics for the given cache region.
| |
| getEntityDeleteCount | back to summary |
|---|---|
| public long getEntityDeleteCount() The global number of entity deletes. | |
| getEntityFetchCount | back to summary |
|---|---|
| public long getEntityFetchCount() The global number of entity fetches. | |
| getEntityInsertCount | back to summary |
|---|---|
| public long getEntityInsertCount() The global number of entity inserts. | |
| getEntityLoadCount | back to summary |
|---|---|
| public long getEntityLoadCount() The global number of entity loads. | |
| getEntityNames | back to summary |
|---|---|
| public String[] getEntityNames() The names of all entities. | |
| getEntityStatistics | back to summary |
|---|---|
| public EntityStatistics getEntityStatistics(String entityName) Obtain the statistics for the entity with the given name.
| |
| getEntityUpdateCount | back to summary |
|---|---|
| public long getEntityUpdateCount() The global number of entity updates. | |
| getFlushCount | back to summary |
|---|---|
| public long getFlushCount() The global number of flush operations executed, including automatic (either manual or automatic). | |
| getNaturalIdCacheHitCount | back to summary |
|---|---|
| public long getNaturalIdCacheHitCount() The global number of cached natural id lookups successfully retrieved from the cache. | |
| getNaturalIdCacheMissCount | back to summary |
|---|---|
| public long getNaturalIdCacheMissCount() The global number of cached natural id lookups not found in the cache. | |
| getNaturalIdCachePutCount | back to summary |
|---|---|
| public long getNaturalIdCachePutCount() The global number of cacheable natural id lookups put in cache. | |
| getNaturalIdQueryExecutionCount | back to summary |
|---|---|
| public long getNaturalIdQueryExecutionCount() The global number of natural id queries executed against the database. | |
| getNaturalIdQueryExecutionMaxTime | back to summary |
|---|---|
| public long getNaturalIdQueryExecutionMaxTime() The global maximum query time for natural id queries executed against the database. | |
| getNaturalIdQueryExecutionMaxTimeEntity | back to summary |
|---|---|
| public @Nullable String getNaturalIdQueryExecutionMaxTimeEntity() The entity name for the maximum natural id query time. | |
| getNaturalIdQueryExecutionMaxTimeRegion | back to summary |
|---|---|
| public @Nullable String getNaturalIdQueryExecutionMaxTimeRegion() The region for the maximum natural id query time. | |
| getNaturalIdStatistics | back to summary |
|---|---|
| public NaturalIdStatistics getNaturalIdStatistics(String entityName) Obtain the natural id resolution statistics for the entity type with the given name.
| |
| getOptimisticFailureCount | back to summary |
|---|---|
| public long getOptimisticFailureCount() The number of Hibernate | |
| getPrepareStatementCount | back to summary |
|---|---|
| public long getPrepareStatementCount() The number of prepared statements that were acquired. | |
| getQueries | back to summary |
|---|---|
| public String[] getQueries() All executed query strings. The maximum number of queries tracked by the Hibernate statistics is determined by the configuration property hibernate.statistics.query_max_size. | |
| getQueryCacheHitCount | back to summary |
|---|---|
| public long getQueryCacheHitCount() The global number of cached queries successfully retrieved from the cache. | |
| getQueryCacheMissCount | back to summary |
|---|---|
| public long getQueryCacheMissCount() The global number of cached queries notnot found in the cache. | |
| getQueryCachePutCount | back to summary |
|---|---|
| public long getQueryCachePutCount() The global number of cacheable queries put in cache. | |
| getQueryExecutionCount | back to summary |
|---|---|
| public long getQueryExecutionCount() The global number of executed queries. | |
| getQueryExecutionMaxTime | back to summary |
|---|---|
| public long getQueryExecutionMaxTime() The time in milliseconds of the slowest query. | |
| getQueryExecutionMaxTimeQueryString | back to summary |
|---|---|
| public @Nullable String getQueryExecutionMaxTimeQueryString() The query string for the slowest query. | |
| getQueryPlanCacheHitCount | back to summary |
|---|---|
| public long getQueryPlanCacheHitCount() The global number of query plans successfully retrieved from cache. | |
| getQueryPlanCacheMissCount | back to summary |
|---|---|
| public long getQueryPlanCacheMissCount() The global number of query plans lookups not found in cache. | |
| getQueryRegionStatistics | back to summary |
|---|---|
| public @Nullable CacheRegionStatistics getQueryRegionStatistics(String regionName) Obtain the second-level cache statistics for the given query cache region.
| |
| getQueryStatistics | back to summary |
|---|---|
| public QueryStatistics getQueryStatistics(String queryString) Obtain the query statistics for the given query string.
| |
| getSecondLevelCacheHitCount | back to summary |
|---|---|
| public long getSecondLevelCacheHitCount() The global number of cacheable entities and collections successfully retrieved from the cache. | |
| getSecondLevelCacheMissCount | back to summary |
|---|---|
| public long getSecondLevelCacheMissCount() The global number of cacheable entities collections not found in the cache and loaded from the database. | |
| getSecondLevelCachePutCount | back to summary |
|---|---|
| public long getSecondLevelCachePutCount() The global number of cacheable entities and collections put in the cache. | |
| getSecondLevelCacheRegionNames | back to summary |
|---|---|
| public String[] getSecondLevelCacheRegionNames() All second-level cache region names. For backwards compatibility, this method returns just the names of regions storing domain data, not query result cache regions. | |
| getSessionCloseCount | back to summary |
|---|---|
| public long getSessionCloseCount() The global number of sessions closed. | |
| getSessionOpenCount | back to summary |
|---|---|
| public long getSessionOpenCount() The global number of sessions opened. | |
| getSlowQueries | back to summary |
|---|---|
| public Map If hibernate.log_slow_query is enabled, a map from the SQL query to the maximum execution time in milliseconds.
| |
| getStart | back to summary |
|---|---|
| public Instant getStart() The | |
| getStartTime | back to summary |
|---|---|
| public long getStartTime()
The Instant#toEpochMilli() milliseconds since the
initial creation of this instance, or since the last time
| |
| getSuccessfulTransactionCount | back to summary |
|---|---|
| public long getSuccessfulTransactionCount() The number of transactions we know to have been successful. | |
| getTransactionCount | back to summary |
|---|---|
| public long getTransactionCount() The number of transactions we know to have completed. | |
| getUpdateTimestampsCacheHitCount | back to summary |
|---|---|
| public long getUpdateTimestampsCacheHitCount() The global number of timestamps successfully retrieved from cache. | |
| getUpdateTimestampsCacheMissCount | back to summary |
|---|---|
| public long getUpdateTimestampsCacheMissCount() The global number of timestamp requests that were not found in the cache. | |
| getUpdateTimestampsCachePutCount | back to summary |
|---|---|
| public long getUpdateTimestampsCachePutCount() The global number of timestamps put in cache. | |
| isStatisticsEnabled | back to summary |
|---|---|
| public boolean isStatisticsEnabled() Is collection of statistics enabled? | |
| logSummary | back to summary |
|---|---|
| public void logSummary() Log the main statistics at level | |
| setStatisticsEnabled | back to summary |
|---|---|
| public void setStatisticsEnabled(boolean enabled) Enable or disable statistics collection. | |