-1
我是新來的谷歌應用程序引擎,我正在閱讀此頁: https://developers.google.com/appengine/docs/java/datastore/queries如何將數據存儲在谷歌應用程序引擎
在這裏,他們解釋瞭如何從數據存儲中檢索數據:
// 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");
}
但如何保存這些數據,以及如何將這個firstName和LastName保存在DataStore中?
感謝