[英]Is this the correct way to set and get a string value using persistance in GAE?
這是在GAE中使用持久性設置和獲取字符串值的正確方法嗎?
我收到錯誤消息:
com.google.appengine.api.datastore.EntityNotFoundException: No entity was found matching the key: jsonString("jsonString")
新增至商店:
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Key key = KeyFactory.createKey("jsonString", "jsonString");
Entity urlEntity = new Entity("jsonString" , key);
urlEntity.setProperty("urlVal", urlVal);
com.google.appengine.api.datastore.Key urlEntityKey = datastore.put(urlEntity);
從商店退貨:
Key key = KeyFactory.createKey("jsonString", "jsonString");
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Entity entity = datastore.get(key);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.