Skip to content

Instantly share code, notes, and snippets.

@cosbor11
Created April 7, 2016 03:40
Show Gist options
  • Select an option

  • Save cosbor11/ad9f87a8189eb81afebc4e45e08f05b2 to your computer and use it in GitHub Desktop.

Select an option

Save cosbor11/ad9f87a8189eb81afebc4e45e08f05b2 to your computer and use it in GitHub Desktop.
Query partitioned data
// Create a query that includes the partition and flag for whether the NSA is listening
// Area Code is partitioned and isNSAListening is indexed. This should be an optimized query
QueryCriteria nsaListeningCriteria = new QueryCriteria(
"isNSAListening", QueryCriteriaOperator.EQUAL, true);
Query query = new Query(CallLog.class, nsaListeningCriteria);
query.setPartition(555);
List<CallLog> nsaIsWastingThereTimeListeningTo = manager.executeQuery(query);
assertTrue("NSA is only listening to 1 call in area code 555", nsaIsWastingThereTimeListeningTo.size() == 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment