public class QueryPlanCache extends Object implements Serializable
AvailableSettings.QUERY_PLAN_CACHE_PARAMETER_METADATA_MAX_SIZE
,
AvailableSettings.QUERY_PLAN_CACHE_MAX_SIZE
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PARAMETER_METADATA_MAX_COUNT
The default strong reference count.
|
static int |
DEFAULT_QUERY_PLAN_MAX_COUNT
The default soft reference count.
|
Constructor and Description |
---|
QueryPlanCache(SessionFactoryImplementor factory)
Constructs the QueryPlanCache to be used by the given SessionFactory
|
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Clean up the caches when the SessionFactory is closed.
|
FilterQueryPlan |
getFilterQueryPlan(String filterString,
String collectionRole,
boolean shallow,
Map<String,Filter> enabledFilters)
Get the query plan for the given collection HQL filter fragment, creating it and caching it if not already cached
|
HQLQueryPlan |
getHQLQueryPlan(String queryString,
boolean shallow,
Map<String,Filter> enabledFilters)
Get the query plan for the given HQL query, creating it and caching it if not already cached
|
NativeQueryInterpreter |
getNativeQueryInterpreter() |
NativeSQLQueryPlan |
getNativeSQLQueryPlan(NativeSQLQuerySpecification spec)
Get the query plan for a native SQL query, creating it and caching it if not already cached
|
ParameterMetadata |
getSQLParameterMetadata(String query,
boolean isOrdinalParameterZeroBased)
Obtain the parameter metadata for given native-sql query.
|
public static final int DEFAULT_PARAMETER_METADATA_MAX_COUNT
public static final int DEFAULT_QUERY_PLAN_MAX_COUNT
public QueryPlanCache(SessionFactoryImplementor factory)
factory
- The SessionFactorypublic ParameterMetadata getSQLParameterMetadata(String query, boolean isOrdinalParameterZeroBased)
query
- The querypublic HQLQueryPlan getHQLQueryPlan(String queryString, boolean shallow, Map<String,Filter> enabledFilters) throws QueryException, MappingException
queryString
- The HQL query stringshallow
- Whether the execution will be shallowenabledFilters
- The filters enabled on the SessionQueryException
- Indicates a problem translating the queryMappingException
- Indicates a problem translating the querypublic FilterQueryPlan getFilterQueryPlan(String filterString, String collectionRole, boolean shallow, Map<String,Filter> enabledFilters) throws QueryException, MappingException
filterString
- The HQL filter fragmentcollectionRole
- The collection being filteredshallow
- Whether the execution will be shallowenabledFilters
- The filters enabled on the SessionQueryException
- Indicates a problem translating the queryMappingException
- Indicates a problem translating the querypublic NativeSQLQueryPlan getNativeSQLQueryPlan(NativeSQLQuerySpecification spec)
spec
- The native SQL query specificationQueryException
- Indicates a problem translating the queryMappingException
- Indicates a problem translating the querypublic void cleanup()
Note that depending on the cache strategy implementation chosen, clearing the cache might not reclaim all the memory.
Typically, when using LIRS, clearing the cache only invalidates the entries but the outdated entries are kept in memory until they are replaced by others. It is not considered a memory leak as the cache is bounded.
public NativeQueryInterpreter getNativeQueryInterpreter()
Copyright © 2019 JBoss by Red Hat. All rights reserved.