public class QueryUtility extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
QueryUtility.PagedDataFetchSettings
|
| Constructor and Description |
|---|
QueryUtility() |
| Modifier and Type | Method and Description |
|---|---|
static String |
escapeSearchParameter(String value)
Given the settings for the current DatabaseType, properly handle escaping special SQL characters.
|
static <T> org.rhq.core.domain.util.PageList<T> |
fetchPagedDataAndCount(javax.persistence.Query dataQuery,
javax.persistence.Query countQuery,
org.rhq.core.domain.util.PageControl pageControl,
QueryUtility.PagedDataFetchSettings settings)
Fetches the data and the total count using the provided queries, according to the provided
pageControl
object. |
static String |
formatSearchParameter(String value)
Given the settings for the current DatabaseType, properly handle escaping special SQL characters as
well as UPCASING the value (standard for rhq filter searches) and wrapping with SQL wildcard for
implicit "contains" (i.e.
|
static String |
getEscapeCharacter()
Get the proper ESCAPE clause character for the current DatabaseType.
|
static String |
getEscapeClause()
Get the proper LIKE operator escape clause for the current DatabaseType.
|
static String |
getEscapeClauseCharacter()
Get the proper ESCAPE clause character for the current DatabaseType.
|
public static final int DEFAULT_PHANTOM_READ_MAX_ATTEMPTS
PHANTOM_READ_MAX_ATTEMPTS.public static final int DEFAULT_PHANTOM_READ_MIN_WAIT_TIME
PHANTOM_READ_MIN_WAIT_TIME.public static final int DEFAULT_PHANTOM_READ_MAX_WAIT_TIME
PHANTOM_READ_MAX_WAIT_TIME.public static final int PHANTOM_READ_MAX_ATTEMPTS
fetchPagedDataAndCount(javax.persistence.Query,
javax.persistence.Query, org.rhq.core.domain.util.PageControl,
org.rhq.enterprise.server.util.QueryUtility.PagedDataFetchSettings) method tries to get consistent results.
Inconsistent results may be caused by a phantom read in the database between performing the data and total count
queries.public static final int PHANTOM_READ_MIN_WAIT_TIME
fetchPagedDataAndCount(javax.persistence.Query,
javax.persistence.Query, org.rhq.core.domain.util.PageControl,
org.rhq.enterprise.server.util.QueryUtility.PagedDataFetchSettings) method when trying to get consistent
results. The wait time gradually increases in a geometric progression from this value to the
PHANTOM_READ_MAX_WAIT_TIME over PHANTOM_READ_MAX_ATTEMPTS.
Inconsistent results may be caused by a phantom read in the database between performing the data and total count
queries.public static final int PHANTOM_READ_MAX_WAIT_TIME
fetchPagedDataAndCount(javax.persistence.Query,
javax.persistence.Query, org.rhq.core.domain.util.PageControl,
org.rhq.enterprise.server.util.QueryUtility.PagedDataFetchSettings) method when trying to get consistent
results. The wait time gradually increases in a geometric progression from PHANTOM_READ_MIN_WAIT_TIME to
this value over PHANTOM_READ_MAX_ATTEMPTS.
Inconsistent results may be caused by a phantom read in the database between performing the data and total count
queries.public static <T> org.rhq.core.domain.util.PageList<T> fetchPagedDataAndCount(javax.persistence.Query dataQuery,
javax.persistence.Query countQuery,
org.rhq.core.domain.util.PageControl pageControl,
QueryUtility.PagedDataFetchSettings settings)
throws PhantomReadMaxAttemptsExceededException
pageControl
object.
The fetch can be set up to try and avoid phantom reads - i.e. the possible inconsistencies between the number
of results, the obtained total count and the page control objects.T - the type of the result entitiesdataQuery - the query to use to fetch the data. The provided pageControl is used to set the paging
on this query.countQuery - the query to use to obtain the total number of resultspageControl - the object to control the paging of the resultssettings - the optional settings of the fetching. If null is passed, the behavior is the same as if a "default"
instance of the QueryUtility.PagedDataFetchSettings was passed.PhantomReadMaxAttemptsExceededException - if the settings specified to throw an exception on exceeding the
number of attempts to avoid phantom readPageControl.isConsistentWith(java.util.Collection, int)public static String escapeSearchParameter(String value)
value - public static String formatSearchParameter(String value)
value - public static String getEscapeClause()
public static String getEscapeClauseCharacter()
public static String getEscapeCharacter()
Copyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.