2014-12-23 50 views
0

如何在Google App Engine中使用com.google.appengine.api.datastore.Category属性 - Java?Google App Engine中的类别属性 - Java

类的构造函数只需要String。我不确定我们是否可以使用Category作为Multi值属性。任何输入或例如这是赞赏。

回答

0

找不到Category属性的用法。所以,我想下面所提到使用List

Setting the property as mentioned below: 
//tags can contain TAG1, TAG2, TAG3, etc 
List<String> tags; 
entity.setProperty("tags", tags); 

查询属性:

List<String> tags = (List<String>)entity.getProperty("tags"); 
:以下提到

String tag = "TAG1"; 
Query q = new Query("EntityType").setAncestor(parentEntity.getKey()).setFilter(FilterOperator.EQUAL.of("tags", tag)); 

获取属性