159 words

deletePersistentAll() - JDO Query's method

Method
javax.jdo.Query
long deletePersistentAll()

Deletes all the instances of the candidate class that pass the filter. Returns the number of instances of the candidate class that were deleted, specifically not including the number of dependent and embedded instances.

Dirty instances of affected classes in the cache are first flushed to the datastore. Instances in the cache or brought into the cache as a result of executing one of the deletePersistentAll methods undergo life cycle changes as if deletePersistent were called on them.

Specifically, if the class of deleted instances implements the delete callback interface, the corresponding callback methods are called on the deleted instances. Similarly, if there are lifecycle listeners registered for delete events on affected classes, the listener is called for each appropriate deleted instance.

Before returning control to the application, instances of affected classes in the cache are refreshed to reflect whether they were deleted from the datastore.

Returns:
the number of instances of the candidate class that were deleted
Since:
JDO 2.0

This documentation page is derived (with some adjustments) from the JDO 2.2 API
and is available under the terms of the Apache License, v. 2.0.