public class StringBasedGemfireRepositoryQuery extends GemfireRepositoryQuery
GemfireRepositoryQuery
using plain String
based OQL queries.
SelectResults
,
Page
,
Pageable
,
Sort
,
GemfireTemplate
,
Query
,
GemfireRepositoryQuery
,
OqlQueryExecutor
,
Repository
,
QueryMethod
,
RepositoryQuery
Constructor and Description |
---|
StringBasedGemfireRepositoryQuery(String query,
GemfireQueryMethod queryMethod,
GemfireTemplate template)
Constructs a new instance of
StringBasedGemfireRepositoryQuery initialized with
the given query , GemfireQueryMethod and GemfireTemplate . |
Modifier and Type | Method and Description |
---|---|
StringBasedGemfireRepositoryQuery |
asDerivedQuery()
Builder method used to set this
RepositoryQuery as derived. |
StringBasedGemfireRepositoryQuery |
asUserDefinedQuery()
Builder method used to set this
RepositoryQuery as user-defined. |
Object |
execute(Object[] arguments) |
protected OqlQueryExecutor |
getNonPagedQueryExecutor()
Returns the configured
OqlQueryExecutor (strategy) used to execute Apache Geode
non-paged OQL queries . |
protected OqlQueryExecutor |
getPagedQueryExecutor()
|
protected QueryString |
getQuery()
Returns a reference to the
managed query . |
protected GemfireTemplate |
getTemplate()
Returns a reference to the
GemfireTemplate used to perform all data access and query operations. |
boolean |
isDerivedQuery()
Determines whether the OQL query represented by this
RepositoryQuery is derived from
the Repository infrastructure QueryMethod name/signature conventions. |
boolean |
isUserDefinedQuery()
Determines whether the OQL query represented by this
RepositoryQuery is user-defined
or was generated by the Spring Data Repository infrastructure. |
protected String |
prepareQuery(QueryMethod queryMethod,
QueryString query,
Object[] arguments)
Prepares the OQL query statement to execute.
|
protected Object |
processQueryResults(QueryMethod queryMethod,
org.apache.geode.cache.query.SelectResults<?> selectResults,
Object... arguments)
Processes the OQL query
result set . |
protected OqlQueryExecutor |
resolveOqlQueryExecutor(QueryMethod queryMethod)
Resolves the
OqlQueryExecutor used to execute the OQL query statement modeled by
the given QueryMethod . |
getGemfireQueryMethod, getLogger, getQueryMethod, getQueryPostProcessor, register
public StringBasedGemfireRepositoryQuery(String query, GemfireQueryMethod queryMethod, GemfireTemplate template)
StringBasedGemfireRepositoryQuery
initialized with
the given query
, GemfireQueryMethod
and GemfireTemplate
.query
- String
containing the OQL query to execute;
must not be null or empty.queryMethod
- GemfireQueryMethod
implementing the RepositoryQuery
;
must not be null.template
- GemfireTemplate
used to execute QOL queries;
must not be null.IllegalArgumentException
- if GemfireQueryMethod
or GemfireTemplate
are null.IllegalStateException
- if the GemfireQueryMethod
represents a modifying query.GemfireQueryMethod
,
GemfireTemplate
@NonNull public StringBasedGemfireRepositoryQuery asDerivedQuery()
RepositoryQuery
as derived.Repository
infrastructure
QueryMethod
name/signature.asUserDefinedQuery()
@NonNull public StringBasedGemfireRepositoryQuery asUserDefinedQuery()
RepositoryQuery
as user-defined.RepositoryQuery
.isUserDefinedQuery()
public boolean isDerivedQuery()
RepositoryQuery
is derived from
the Repository
infrastructure QueryMethod
name/signature conventions.RepositoryQuery
is derived.asDerivedQuery()
,
isUserDefinedQuery()
public boolean isUserDefinedQuery()
RepositoryQuery
is user-defined
or was generated by the Spring Data Repository
infrastructure.
An OQL query is user-defined if the query was specified using the Query
annotation on
the Repository
QueryMethod
or was specified in the <module>-named-queries.properties
file.
Derived queries are not user-defined.RepositoryQuery
is user-defined.asUserDefinedQuery()
,
isDerivedQuery()
@NonNull protected OqlQueryExecutor getNonPagedQueryExecutor()
OqlQueryExecutor
(strategy) used to execute Apache Geode
non-paged
OQL queries
.OqlQueryExecutor
(strategy) used to execute Apache Geode
non-paged
OQL queries
.OqlQueryExecutor
@NonNull protected OqlQueryExecutor getPagedQueryExecutor()
OqlQueryExecutor
(strategy) used to execute Apache Geode
paged
OQL queries
.OqlQueryExecutor
@NonNull protected QueryString getQuery()
managed query
.managed query
.QueryString
@NonNull protected GemfireTemplate getTemplate()
GemfireTemplate
used to perform all data access and query operations.GemfireTemplate
used to perform all data access and query operations.GemfireTemplate
@NonNull protected String prepareQuery(@NonNull QueryMethod queryMethod, @NonNull QueryString query, @NonNull Object[] arguments)
queryMethod
- QueryMethod
modeling the OQL query.query
- QueryString
containing the OQL query statement.arguments
- array of Object
values containing the arguments for the OQL query bind in parameters.QueryPostProcessor
,
QueryString
,
QueryMethod
,
bindInParameters(QueryMethod, QueryString, Object[])
,
resolveFromClause(QueryMethod, QueryString)
,
GemfireRepositoryQuery.getQueryPostProcessor()
@NonNull protected OqlQueryExecutor resolveOqlQueryExecutor(@NonNull QueryMethod queryMethod)
OqlQueryExecutor
used to execute the OQL query statement
modeled by
the given QueryMethod
.queryMethod
- QueryMethod
used to resolve the OqlQueryExecutor
; must not be null.OqlQueryExecutor
appropriate for executing the OQL query statement
modeled by the give QueryMethod
.OqlQueryExecutor
,
QueryMethod
@Nullable protected Object processQueryResults(@NonNull QueryMethod queryMethod, @NonNull org.apache.geode.cache.query.SelectResults<?> selectResults, @NonNull Object... arguments)
result set
.queryMethod
- QueryMethod
modeling the OQL query.selectResults
- SelectResults
from the execution of the OQL query.IncorrectResultSizeDataAccessException
- if the query result does not match
the QueryMethod
return type
.IllegalStateException
- if the OQL query is not supported based on the return value.QueryMethod
,
SelectResults
Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.