我是 Google App Engine 的新手,我正在阅读此页面: https ://developers.google.com/appengine/docs/java/datastore/queries
在这里,他们解释了如何从 dataStore 中检索数据:
// Get the Datastore Service
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
// The Query interface assembles a query
Query q = new Query("Person");
//Use CompositeFilter to set more than one filter
q.setFilter(CompositeFilterOperator.and(
new FilterPredicate("lastName", Query.FilterOperator.EQUAL, lastNameParam),
new FilterPredicate("height", Query.FilterOperator.LESS_THAN, maxHeightParam)));
// PreparedQuery contains the methods for fetching query results
// from the Datastore
PreparedQuery pq = datastore.prepare(q);
for (Entity result : pq.asIterable()) {
String firstName = (String) result.getProperty("firstName");
String lastName = (String) result.getProperty("lastName");
Long height = (Long) result.getProperty("height");
System.out.println(firstName + " " + lastName + ", " + height + " inches tall");
}
但是如何保存这个 data.where 以及这个 firstName 和 LastName 是如何保存在 DataStore 中的?
谢谢