I am trying to delete a large number of rows from MOTHER
thanks to a JPQL query.
The Mother
class is defined as follows:
@E
You could relay on the RDBMS to delete those Mother
s using foreign key constraint.
This assumes your generateing your DDL from entities:
@Entity
@Table(name = "CHILD")
public class Child implements Serializable {
@ManyToOne
@JoinColumn(name = "MOTHER_ID", foreignKey = @ForeignKey(foreignKeyDefinition =
"FOREIGN KEY(MOTHER_ID) REFERENCES MOTHER(ID) ON DELETE CASCADE",
value = ConstraintMode.CONSTRAINT))
private Mother mother;
}