Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.4
  Go To Table Of Contents
 Search
 PDFComments
Comments


@DeleteAll

Use @DeleteAll to indicate that when an relationship is deleted, EclipseLink should use a delete all query. This typically happens if the relationship is PrivateOwned and its owner is deleted. In that case, the members of the relationship will be deleted without reading them in.


Annotation Elements

There are no elements for this annotation.


Usage


WARNING:

Use this annotation with caution. EclipseLink will not validate whether the target entity is mapped in such a way as to allow the delete all to work.



Examples

Example 2-38 shows how to use @DeleteAll on a relationship mapping.

Example 2-38 Using @DeleteAll Annotation

@Entity
public class Department {
  ...
  @OneToMany(mappedBy = "department")
  @PrivateOwned
  @DeleteAll
  public List<Equipment> getEquipment() {
    return equipment;
    }
  ...
  }
 

Example 2-38 shows how to use the <delete-all> element in the eclipselink-orm.xml file.

Example 2-39 Using <delete-all> XML

<entity class="Department">
  ...
  <attributes>
    <one-to-many name="equipment" target-entity="Equipment" mapped-by="department">
      <private-owned/>
      <delete-all/>
    </one-to-many>
...
</attributes>
</entity>


See Also

For more information, see: