You can download the code for this example here:
This tutorial demonstrates easy it is to bulk delete entities that meet a given criteria.
To demonstrate this we will delete all Player entities that have the active attribute set to false.
To see how the data was seeded for this example, see Main.java
- Get an Instance of the PersistenceManager.
- Create a Query and QueryCriteria
Internally, Onyx Database will delete all off the entities applicable to the criteria.
- Before executing the delete, confirm that there are entities there to delete
- Invoke the PersistenceManager#executeDelete method
This will execute the delete action
- Now, lets re-execute the query to verify that the entities were deleted.
- Make sure to close the factory when you are done with it.
- Update Query