public void BasicQuery ( ) throws StorageException { // Retrieve a single entity. // Retrieve the entity with partition key of "Smith" and row key of // "Jeff". TableOperation retrieveSmithJeff = TableOperation . retrieve ( "Smith" , "Jeff" , CustomerEntity . class ) ; // Submit the operation to the table service and get the specific // entity. @ SuppressWarnings ( "unused" ) CustomerEntity specificEntity = table . execute ( retrieveSmithJeff ) . getResultAsType ( ) ; // Retrieve all entities in a partition. // Create a filter condition where the partition key is "Smith". String partitionFilter = TableQuery . generateFilterCondition ( "PartitionKey" , QueryComparisons . EQUAL , "Smith" ) ; // Specify a partition query, using "Smith" as the partition key filter. TableQuery < CustomerEntity > partitionQuery = TableQuery . from ( CustomerEntity . class ) . where ( partitionFilter ) ; // Loop through the results, displaying information about the entity. for ( CustomerEntity entity : table . execute ( partitionQuery ) ) { act . outputText ( view , entity . getPartitionKey ( ) + " " + entity . getRowKey ( ) + "\t" + entity . getEmail ( ) + "\t" + entity . getPhoneNumber ( ) ) ; } }
Illustrates how to form and execute a query operation .