【发布时间】:2017-06-20 13:50:34
【问题描述】:
谁能解释一下,我怎样才能在谷歌数据存储中获取单个行的属性,这是我的代码
public Entity useravailable(String name, String pass) {
DatastoreService entityStore = DatastoreServiceFactory.getDatastoreService();
Key k = KeyFactory.createKey("databasecont", name);
try {
Entity user = entityStore.get(k);
System.out.println("password of user in db"+userHaveAccount);
if ("password".equals(password)) // Here check the database password with the password("passed as argument to this function")
return userHaveAccount;
else
return null;
}
catch (EntityNotFoundException e1) {
return null;
}
}
在if条件下,我需要检查从数据库(密码)获取的值,参数传递(pass),如何从数据库中检索密码?
Kind(表名) -> databasecont,
properities(columns) -> 名称,密码,
键(主键)-> 名称
【问题讨论】:
标签: java google-app-engine servlets google-cloud-datastore