Why does the code below result in org.datanucleus.exceptions.NucleusUserException: Object Manager has been closed? The exception appears to be thrown at query.getResultList(
I don't know why exactly, but it seems to have to do with query.getResultList()
being lazy-loaded. Apparently the lazy-loading breaks down when you call remove(token)
.
As a work-around can you collect the ids/keys for the elements in an ArrayList first, and in a separate loop remove them from the datastore?
Adding @Transactional
to the method prevents the object manager from closing. However, I'm not sure why it closes without this.
the solution that worked for me and a description of the bug i found here:
http://groups.google.com/group/google-appengine-java/browse_thread/thread/945f6ca66c1c587e