Is there a way to delete an entity without having to fetch it from the datastore first? I am assuming I already have the key or id for the entity.
I'm thinking of something like deleteObjectById
that would be an analogue to getObjectById
on PersistenceManager
.
The closest I can think of is using Query.deletePersistentAll()
(as seen here) and specifying a query that only relies on the key, but I can't tell if that is going to fetch the entity before deleting it.
thanks
EDIT: I know how to do this using the low level API, as well as in the python API. I was wondering if there was a way to do it within the JDO layer.
datanucleus answered my question on the 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.