编程语言
首页 > 编程语言> > java-通过键删除实体,而无需先在应用程序引擎中获取实体(使用JDO)

java-通过键删除实体,而无需先在应用程序引擎中获取实体(使用JDO)

作者:互联网

有没有一种方法可以删除实体而不必先从数据存储中获取它?我假设我已经有了实体的密钥或ID.
我在想像deleteObjectById之类的东西,它类似于PersistenceManager上的getObjectById.

我能想到的最接近的方法是使用Query.deletePersistentAll()(如here所示)并指定仅依赖于键的查询,但我无法确定在删除实体之前是否要获取该实体.

谢谢

编辑:我知道如何使用低级API以及python API来执行此操作.我想知道在JDO层中是否有办法做到这一点.

解决方法:

datanucleus在google group上回答了我的问题:

Not really. The issue is that an object can have relations and so,
since these can cause cascade of operations, it typically has to be
loaded into memory first. The only situation where it wouldn’t need to
be loaded into memory was if the class of the object to be deleted had
no relations.

Going into the low level API and blasting away objects may or may not
have an impact on related objects … perhaps someone responsible for
it could comment on that.

标签:jdo,google-app-engine,datanucleus,java
来源: https://codeday.me/bug/20191107/2002428.html