开发者

App Engine datastore: How to set multiple values on properties?

I'm using app eng开发者_JS百科ine (Java) datastore API to build a project. I'm not using JDO/JPA but low level API.

How can I set multiple values for an entity property? I can find documentation about how to do so when using JDO or JPA (using Lists) but can't find that info for low level API.

Thanks.


You can pass a Collection as the value for a property in 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).

See the setProperty javadoc here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜