google-app-engine – App Engine数据存储:如何在属性上设置多个值?

我正在使用app engine(
Java)数据存储区API来构建项目.我不是在使用JDO / JPA而是使用低级API.

如何为实体属性设置多个值?我可以在使用JDO或JPA(使用列表)时找到有关如何执行此操作的文档,但无法找到低级API的信息.

谢谢.

最佳答案 您可以将Collection作为Entity.setProperty()中属性的值传递.

If value is a Collection, the values will be stored in the datastore with the collection’s iteration order with one caveat: all indexed values will come before all unindexed values (this can occur if the Collection contains both values that are normally indexed like strings, and values that are never indexed like Blob, Text and EmbeddedEntity).

请参阅setProperty javadoc here.

点赞