Object deletion with optimistic version field failed



Since I added optimistic locking, with a numeric version attribute, the deletion doesn't work.
ERROR DataNucleus.Persistence - Object with id "1" in table I18N_MESSAGE has no version set on the object in memory and you want to delete it!! Please report this bug to the developers of DataNucleus with a way of reproducing it

Object during the DeleteRequest#execute

This object seems properly loaded.

Here are the details of persistence:

when DeleteRequest gets the currentVersion Object currentVersion = op.getTransactionalVersion(); it receives null.

Object is found by query (getSingleResult), then deleted by EntityManager.remove(id)

getSingleResult => statemanagerimpl#connect => transactionalVersion=null
statemanagerimpl#setversion is never called to set the transactionalVersion

EntityManager.remove(id) => op.getTransactionalVersion = null => error occurs


Join main@datanucleus.groups.io to automatically receive all group messages.