Amit-

You have 3 main and separate ways you query Region data...

1. Using SD Repositories and SDG's support for them (http://docs.spring.io
/spring-data-gemfire/docs/current/reference/html/#gemfire-repositories.executing-queries)
as Udo pointed out.

2. You can use the SDG GemfireTemplate (http://docs.spring.io/spring-data-
gemfire/docs/current/api/org/springframework/data/gemfire/GemfireTemplate
.html)

3. Or, you can simply use the Geode API (i.e. QueryService (http://geode.
apache.org/releases/latest/javadoc/org/apache/geode/cache/query/QueryService.html),
Query, SelectResults, and so on).

The interesting tidbit here is that the Repository abstraction and SDG's
Repository extension for Geode is built on the GemfireTemplate
(under-the-hood) and GemfireTemplate uses the QueryService API
(under-the-hood).

However, the advantages of using Spring of Geode's API are...

1. You get a "consistent" Data Access Exception Hierarchy (
http://docs.spring.io/spring/docs/current/spring-framework-reference/
htmlsingle/#dao-exceptions) across your entire application regardless of
data store, particularly useful if you are using more than 1 data store,
but even advisable if you are not, particularly for *Spring*-based
applications.

2. Your application code/logic (whether using the *Repository* abstraction
or your own custom DAOs (using the GemfireTemplate)), will automatically
pick up and participate in *Spring's* Transaction Management when your
@Service components are demarcated with *Spring* @Transaction annotations.
SDG can sync Geode with *Spring* Transactions (either local Cache or Global
GTA).  See here... http://docs.spring.io/spring-data-gemfire
/docs/current/reference/html/#apis:tx-mgmt

3. Finally, SDG shields your application from Geode API breaking changes.
If the Geode API changes, then only the GemfireTemplate need change
under-the-hood.

There are other subtle advantages here, but the above represents the main
ones.

Hope this helps.

Cheers,
John


On Fri, Jan 13, 2017 at 11:39 AM, Udo Kohlmeyer <[email protected]>
wrote:

> Hi Amit,
>
> Have you looked at this yet?
>
> http://docs.spring.io/spring-data-gemfire/docs/current/refer
> ence/html/#gemfire-repositories.executing-queries
>
> --Udo
>
>
> On 1/13/17 11:30, Amit Pandey wrote:
>
>> Hi Guys,
>>
>> How can I query regions with Spring Gemfire?
>>
>> Regards
>>
>
>


-- 
-John
john.blum10101 (skype)

Reply via email to