【问题标题】:How to store indexable list/collection in an appengine entity?如何在 appengine 实体中存储可索引列表/集合?
【发布时间】:2013-01-05 22:39:43
【问题描述】:

创建实体后:

DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Entity employee = new Entity("Employee");

如何设置可索引的列表属性?喜欢说:

employee.setProperty("tag", "manager", "corrupted", ...);
//  "tag" is the property name, 
//  "manager", "corrupted".. are the values in the list.

【问题讨论】:

    标签: java google-app-engine indexing google-cloud-datastore bigtable


    【解决方案1】:

    查看javadoc,您可以将 Collection 作为第二个参数传递给 setProperty。

    例如

    List<String> tags = new ArrayList<String>();
    tags.add("manager");
    tags.add("corrupted");
    
    employee.setProperty("tag", tags);
    

    【讨论】:

      猜你喜欢
      • 2012-10-01
      • 1970-01-01
      • 2014-09-08
      • 2020-09-15
      • 1970-01-01
      • 2018-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多