我正在执行方法Datastore.delete(键)组成我的GWT Web应用程序,AsyncCallback调用了onSuccess()方法。我立即刷新http://localhost:8888/_ah/admin
,实体i意图删除仍然存在。同样,我立即刷新我的GWT Web应用程序,我想删除的项目仍然显示在网页上。请注意onSuccess()已被调用。如何知道Google AppEngine数据存储区的操作已完成
那么,我怎么知道实体何时已经被删除?
public void deleteALocation(int removedIndex,String symbol){
if(Window.confirm("Sure ?")){
System.out.println("XXXXXX " +symbol);
loCalservice.deletoALocation(symbol, callback_delete_location);
}
}
public AsyncCallback<String> callback_delete_location = new AsyncCallback<String>() {
public void onFailure(Throwable caught) {
Window.alert(caught.getMessage());
}
public void onSuccess(String result) {
// TODO Auto-generated method stub
int removedIndex = ArryList_Location.indexOf(result);
ArryList_Location.remove(removedIndex);
LocationTable.removeRow(removedIndex + 1);
//Window.alert(result+"!!!");
}
};
服务器:
public String deletoALocation(String name) {
// TODO Auto-generated method stub
Transaction tx = Datastore.beginTransaction();
Key key = Datastore.createKey(Location.class,name);
Datastore.delete(tx,key);
tx.commit();
return name;
}
,对不起,我的英语:-)
每次重新加载页面时,都要查询数据库以获取实际数据。 – kapand