需求是更新實體中某一行的字段。但下面的代碼正在更新實體行。我在哪裏犯錯誤?GAE:JAVA-只更新實體特定行中的一個字段
//Inserting
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
//Util.getKey() always returns current Date
Key ky=KeyFactory.createKey("Routine", Util.getKey());
Entity e = new Entity("Routine",ky);
e.setProperty("running", Constants.RUNNING_INCREDIBLE);
datastore.put(e);
//Updating
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Key ky=KeyFactory.createKey("Routine", Util.getKey());
Entity e2=datastore.get(ky);
e2.setProperty("bAS", Constants.BAS_INCREDIBLE);
datastore.put(e);
如果最後一行是'datastore.put(E2)'? –
對不起..這是錯誤的是e2只... – user1742919