Just to add my cache is ofcourse partitioned, in replicated I understand I can query the cache without that problem.
Regards On Sun, Jan 15, 2017 at 9:09 PM, Amit Pandey <[email protected]> wrote: > I > Hi John, > > I got this working thanks. > > Using Spring Data does help in making the API cleaner. > > However I want to ensure in functions that only local data for the > partitioned cache is extracted, is there any way to ensure that via Spring > Data? > > This can help to get data if I have PK:- PartitionRegionHelper. > getLocalDataForContext(context) > .get(k); > > But I have to query so is there any way to do it? > > Regards > > On Sat, Jan 14, 2017 at 1:25 AM, Amit Pandey <[email protected]> > wrote: > >> Udo and John, >> >> Many thanks..I could use QueryService. >> >> However I am getting some weirde errors when I am trying to use >> QueryService from inside Geode. I will post here, again tomorrow >> >> On Sat, Jan 14, 2017 at 1:23 AM, John Blum <[email protected]> wrote: >> >>> 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) >>> >> >> >
