Skip to content

Instantly share code, notes, and snippets.

@sharrissf
Created February 16, 2011 00:37
Show Gist options
  • Save sharrissf/828611 to your computer and use it in GitHub Desktop.
Save sharrissf/828611 to your computer and use it in GitHub Desktop.
Sample of doing a query
Query query = cache.createQuery();
query.includeKeys();
query.includeValues();
query.addCriteria(name.ilike(“Greg*”).and(gender.eq(Gender.MALE))).addOrderBy(age, Direction.ASCENDING).maxResults(10);
Results results = query.execute();
System.out.println(” Size: ” + results.size());
for (Result result : results.all()) {
System.out.println(“Got: Key[" + result.getKey() + "] Value class [" + result.getValue().getClass() + "] Value [" + result.getValue() + "]“);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment