String queryString = "SELECT * FROM /items";
ClientCache cache = new ClientCacheFactory().create();
QueryService queryService = cache.getQueryService();
Query query = queryService.newQuery(queryString);
SelectResults results = (SelectResults)query.execute();
I want to get the results data into resultset like rdbms. Is there any way to get the data in resultset and iterate using java?
I believe you really need to go through the GemFire User Guide if you want to get proficient on its usage and understand how things work. Regarding this particular question, please have a look at the Querying chapter, it contains useful examples and explanations.
In short, you can iterate through SelectResults
doing something like the following:
SelectResults<YourEntity> results = (SelectResults<YourEntity>) query.execute();
for (Iterator<YourEntity> iterator = results.iterator(); iterator.hasNext();) {
YourEntity entity = iterator.next();
System.out.println(entity);
}
The code above assumes, among other things, that the region items
is populated with instances of the class YourEntity
and that the class itself is deployed to the server's class path.
Cheers.