The Region.query() method converts the provided predicate into a select query string and uses the local query service to execute the query. As Mark has mentioned, if you pass the RegionFunctionContext (directly cast the FunctionContext to a RegionFunctionContext), that should provide similar behavior.
On Wed, Jan 13, 2016 at 10:45 AM, Lyndon Adams <[email protected]> wrote: > I always use the region query method if the query is simple. > > Sent from my iPhone > > On 13 Jan 2016, at 18:30, Real Wes Williams <[email protected]> > wrote: > > > When I’m in a function that was executed onRegion, is it safe to execute > the query on the local region? Or use QueryService? > > The doc on Region.query omits mention when it says: > > * When executed from a client, this method always runs on the server. > * However application should use QueryService to execute queries. > * ... > */ > public <E> SelectResults<E> query(String queryPredicate) > throws FunctionDomainException, TypeMismatchException, > NameResolutionException, > QueryInvocationTargetException; > > But the Spring GemFireTemplate has: > > @Override > public <E> SelectResults<E> query(final String query) { > try { > return this.getRegion().query(query); > > > Thanks, > Wes > >
