Annotation Interface Delete


@Documented @Retention(RUNTIME) @Target(METHOD) public @interface Delete

Lifecycle annotation for repository methods which perform delete operations; alternatively, annotates a repository method as a parameter-based automatic query method which deletes entities.

The Delete annotation indicates that the annotated repository method deletes the state of one or more entities from the database. It may be used in one of two ways: as a lifecycle annotation, to delete a given entity instance or instances, or as an automatic query annotation, to delete all entities satisfying parameter-based conditions.

A Delete method might accept an instance or instances of an entity class. In this case, the method must have exactly one parameter whose type is either:

  • the class of the entity to be deleted, or
  • List<E> or E[] where E is the class of the entities to be deleted.