Search code examples
jdodatanucleus

How to empty a table from DataNucleus' JDO implementation?


I am using DataNucleus' implementation of JDO to populate a table on a local H2 database opened in MySQL mode.

I would like to empty the content of this table (corresponding to a persistance enabled object) from time to time. How can I perform this from the JDO or DataNucleus context without looping through all entries? Is this possible?


Solution

  • This should do it:

    pm.newQuery(YourJDObject.class).deletePersistentAll();