Onyx Database: Batch Deleting Multiple Entities Tutorial

You can download the code for this example here:
OnyxDevTools/onyx-database-samples/persisting-data ... BatchDeletingDataExample.java.

Previously we explained how to perform batch persistence. Onyx Database also provides a method to perform batch deleting using the Persistence Manager.

  1. Get an Entity Persistence Manager via the Persistence Manager Factory
  2. Persist some test data to use later to delete.
    Notes:
    Refer to Batch Saving tutorial for reference
  3. Query the recently created entities
  4. Invoke EmbeddedPerstistenceManager#deleteEntities and pass the list of entities as an argument.
    Notes:
    All entities within the list must be of the same type.
    Be aware of how many entities you are batching at one time in order to conserve memory. In this case we have only added 1000 entities to the list.
  5. Execute the same query in step 3 to attempt to fetch the deleted entities and confirm that they were deleted
    Notes:
    Notice the query did not provide any results
  6. Annotation Reference Guide