Class StringBasedGemfireRepositoryQuery
java.lang.Object
org.springframework.data.gemfire.repository.query.GemfireRepositoryQuery
org.springframework.data.gemfire.repository.query.StringBasedGemfireRepositoryQuery
- All Implemented Interfaces:
org.springframework.data.repository.query.RepositoryQuery
GemfireRepositoryQuery
using plain String
based OQL queries.- See Also:
-
SelectResults
Page
Pageable
Sort
GemfireTemplate
Query
GemfireRepositoryQuery
OqlQueryExecutor
Repository
QueryMethod
RepositoryQuery
-
Constructor Summary
ConstructorDescriptionStringBasedGemfireRepositoryQuery
(String query, GemfireQueryMethod queryMethod, GemfireTemplate template) Constructs a new instance ofStringBasedGemfireRepositoryQuery
initialized with the givenquery
,GemfireQueryMethod
andGemfireTemplate
. -
Method Summary
Modifier and TypeMethodDescriptionBuilder method used to set thisRepositoryQuery
as derived.Builder method used to set thisRepositoryQuery
as user-defined.protected OqlQueryExecutor
Returns the configuredOqlQueryExecutor
(strategy) used to execute Apache Geodenon-paged
OQL queries
.protected OqlQueryExecutor
protected QueryString
getQuery()
Returns a reference to themanaged query
.protected GemfireTemplate
Returns a reference to theGemfireTemplate
used to perform all data access and query operations.boolean
Determines whether the OQL query represented by thisRepositoryQuery
is derived from theRepository
infrastructureQueryMethod
name/signature conventions.boolean
Determines whether the OQL query represented by thisRepositoryQuery
is user-defined or was generated by the Spring DataRepository
infrastructure.protected String
prepareQuery
(org.springframework.data.repository.query.QueryMethod queryMethod, QueryString query, Object[] arguments) Prepares the OQL query statement to execute.protected Object
processQueryResults
(org.springframework.data.repository.query.QueryMethod queryMethod, org.apache.geode.cache.query.SelectResults<?> selectResults, Object... arguments) Processes the OQL queryresult set
.protected OqlQueryExecutor
resolveOqlQueryExecutor
(org.springframework.data.repository.query.QueryMethod queryMethod) Resolves theOqlQueryExecutor
used to execute theOQL query statement
modeled by the givenQueryMethod
.Methods inherited from class org.springframework.data.gemfire.repository.query.GemfireRepositoryQuery
getGemfireQueryMethod, getLogger, getQueryMethod, getQueryPostProcessor, register
-
Constructor Details
-
StringBasedGemfireRepositoryQuery
public StringBasedGemfireRepositoryQuery(String query, GemfireQueryMethod queryMethod, GemfireTemplate template) Constructs a new instance ofStringBasedGemfireRepositoryQuery
initialized with the givenquery
,GemfireQueryMethod
andGemfireTemplate
.- Parameters:
query
-String
containing the OQL query to execute; must not be null or empty.queryMethod
-GemfireQueryMethod
implementing theRepositoryQuery
; must not be null.template
-GemfireTemplate
used to execute QOL queries; must not be null.- Throws:
IllegalArgumentException
- ifGemfireQueryMethod
orGemfireTemplate
are null.IllegalStateException
- if theGemfireQueryMethod
represents a modifying query.- See Also:
-
-
Method Details
-
asDerivedQuery
Builder method used to set thisRepositoryQuery
as derived.- Returns:
- a boolean value indicating whether the OQL query was derived from the
Repository
infrastructureQueryMethod
name/signature. - See Also:
-
asUserDefinedQuery
Builder method used to set thisRepositoryQuery
as user-defined.- Returns:
- this
RepositoryQuery
. - See Also:
-
isDerivedQuery
public boolean isDerivedQuery()Determines whether the OQL query represented by thisRepositoryQuery
is derived from theRepository
infrastructureQueryMethod
name/signature conventions.- Returns:
- a boolean value indicating if the OQL query represented by this
RepositoryQuery
is derived. - See Also:
-
isUserDefinedQuery
public boolean isUserDefinedQuery()Determines whether the OQL query represented by thisRepositoryQuery
is user-defined or was generated by the Spring DataRepository
infrastructure. An OQL query is user-defined if the query was specified using theQuery
annotation on theRepository
QueryMethod
or was specified in the <module>-named-queries.properties file. Derived queries are not user-defined.- Returns:
- a boolean value indicating whether the OQL query represented this
RepositoryQuery
is user-defined. - See Also:
-
getNonPagedQueryExecutor
Returns the configuredOqlQueryExecutor
(strategy) used to execute Apache Geodenon-paged
OQL queries
.- Returns:
- the configured
OqlQueryExecutor
(strategy) used to execute Apache Geodenon-paged
OQL queries
. - See Also:
-
getPagedQueryExecutor
- Returns:
- the configured
OqlQueryExecutor
(strategy) used to execute Apache Geodepaged
OQL queries
. - See Also:
-
getQuery
Returns a reference to themanaged query
.- Returns:
- a reference to the
managed query
. - See Also:
-
getTemplate
Returns a reference to theGemfireTemplate
used to perform all data access and query operations.- Returns:
- a reference to the
GemfireTemplate
used to perform all data access and query operations. - See Also:
-
execute
-
prepareQuery
@NonNull protected String prepareQuery(@NonNull org.springframework.data.repository.query.QueryMethod queryMethod, @NonNull QueryString query, @NonNull Object[] arguments) Prepares the OQL query statement to execute.- Parameters:
queryMethod
-QueryMethod
modeling the OQL query.query
-QueryString
containing the OQL query statement.arguments
- array ofObject
values containing the arguments for the OQL query bind in parameters.- Returns:
- the prepared OQL query to execute.
- See Also:
-
QueryPostProcessor
QueryString
QueryMethod
bindInParameters(QueryMethod, QueryString, Object[])
resolveFromClause(QueryMethod, QueryString)
GemfireRepositoryQuery.getQueryPostProcessor()
-
resolveOqlQueryExecutor
@NonNull protected OqlQueryExecutor resolveOqlQueryExecutor(@NonNull org.springframework.data.repository.query.QueryMethod queryMethod) Resolves theOqlQueryExecutor
used to execute theOQL query statement
modeled by the givenQueryMethod
.- Parameters:
queryMethod
-QueryMethod
used to resolve theOqlQueryExecutor
; must not be null.- Returns:
- the resolve
OqlQueryExecutor
appropriate for executing theOQL query statement
modeled by the giveQueryMethod
. - See Also:
-
OqlQueryExecutor
QueryMethod
-
processQueryResults
@Nullable protected Object processQueryResults(@NonNull org.springframework.data.repository.query.QueryMethod queryMethod, @NonNull org.apache.geode.cache.query.SelectResults<?> selectResults, @NonNull Object... arguments) Processes the OQL queryresult set
.- Parameters:
queryMethod
-QueryMethod
modeling the OQL query.selectResults
-SelectResults
from the execution of the OQL query.- Returns:
- the OQL query results.
- Throws:
org.springframework.dao.IncorrectResultSizeDataAccessException
- if the query result does not match theQueryMethod
return type
.IllegalStateException
- if the OQL query is not supported based on the return value.- See Also:
-
QueryMethod
SelectResults
-