在 Google App Engine 上批量放置预定义键
我想使用 Java 的低级 api 批量放置具有预定义键的实体。
您可以进行批量获取:
Map<Key,Entity> get(.Iterable<Key> keys)
但是批量放置似乎都想分配自己的密钥:
List<Key> put(Iterable<Entity> entities)
我正在尝试批量获取实体集合,更新它们,然后批量将它们放回到数据存储中。我应该能够在不更改键值的情况下执行此操作,这是有道理的,不是吗?
I would like to do a batch put of entities with pre-defined keys using the low-level api for Java.
You can do a batch get:
Map<Key,Entity> get(.Iterable<Key> keys)
However the batch puts all seem to want to allocate their own keys:
List<Key> put(Iterable<Entity> entities)
Documentation page: http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/DatastoreService.html#put(java.lang.Iterable)
I'm trying to batch get on a collection of entities, update them, and then batch put them back into the datastore. It makes sense that I should be able to do this without changing the values of their keys, doesn't it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来我通过发布这个问题而大脑放屁,但也许这会在未来帮助其他人。您所要做的就是在分配实体时设置键:
或者如果您之前已从数据存储中提取了实体,则应该已经设置了键。
Looks like I brain farted by posting this question, but maybe this will help someone else in the future. All you have to do is set the keys when you allocate the entities:
Or if you had previously pulled the entities from the datastore, the keys should already be set.