0

Working on a logging feature, I only wish to keep the last 200 records in the datastore.

How can I do this in JDOQL?

If I'd use SQL it would be as easy as

DELETE FROM MyTable OFFSET 201 ORDER BY myDate DESC,

but I have a hard time to find something similar for JDOQL.

Bo Persson
  • 90,663
  • 31
  • 146
  • 203
doniat
  • 1

1 Answers1

0
Query q = pm.newQuery("SELECT FROM mydomain.MyClass ORDER BY myDate DESC RANGE 201");
q.deletePersistentAll()

Looks very similar to me

DataNucleus
  • 15,497
  • 3
  • 32
  • 37