调用 getObjectById() 时抛出 java.lang.UnsupportedOperationException
我有一个具有如下键设置的实体:
KeyFactory.Builder keyBuilder = new KeyFactory.Builder(MyClass.class.getSimpleName(), "uniqueString");
Key = keyBuilder.getKey();
要按键获取实体,我以完全相同的方式重建键并调用 getObjectById() ,如下所示;
App app = pm.getObjectById(MyClass.class, keyBuilder.getKey());
大多数时候这工作正常,但在某些时候 getObjectById 会抛出此错误:
java.lang.UnsupportedOperationException
有谁知道是什么原因导致的?我意识到这似乎是我在这里描述的一个非常模糊的问题,但这确实是我所知道的。这太奇怪了,看起来甚至可能是 App Engine 的一个错误。
I have an entity with a Key set as follows:
KeyFactory.Builder keyBuilder = new KeyFactory.Builder(MyClass.class.getSimpleName(), "uniqueString");
Key = keyBuilder.getKey();
To fetch an entity by key I reconstruct the key in the exact same way and call getObjectById() as follows;
App app = pm.getObjectById(MyClass.class, keyBuilder.getKey());
Most of the time this works fine but at certain times getObjectById throws this error:
java.lang.UnsupportedOperationException
Does anyone know what causes this? I realise this seems like a very vague problem I've described here but that's really all I know. It's so strange it seems like it may even be a bug with App Engine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该问题是否与此一个相同?似乎可能是 GAE 代码中的错误?如果是相同的,一些用户已经发布了解决该问题的方法。
Could the issue be the same as this one, which seems may be a bug in the GAE code? If it is the same, some users have posted work-arounds to the problem.