How do i delete all the entries using hibernate deleteAll() ?
I have a class with multiple @oneToMany relationships (having like +5000 child entities) and when i try to do deleteAll i get the title error
oracle.jdbc.OracleDatabaseException: ORA-02292: integrity constraint (xxx) violated - child record found
I've tried adding
cascade = {CascadeType.ALL}
and
orphanRemoval=true
to @OneToMany relationship class, but no help.
It's a bidirectional relationship with following classes
@OneToMany(targetEntity = XXX.class, fetch = FetchType.LAZY, cascade = {CascadeType.ALL}, orphanRemoval=true, mappedBy = "zzz")
@Fetch(FetchMode.SELECT)
@JsonManagedReference
private List<XXX> xxx;
@LazyCollection(LazyCollectionOption.FALSE)
@OneToMany(targetEntity = YYY.class, fetch = FetchType.LAZY, orphanRemoval=true, cascade = {CascadeType.ALL}, mappedBy = "zzz")
@Fetch(FetchMode.SELECT)
@JsonManagedReference
private List<YYY> yyy;
with child elements like
@ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.ALL})
@JoinColumn(name = "XXX", nullable=false)
@JsonBackReference
private XXX zzz;
i also tried HQL DELETE query but that dosent get me anywhere either.
How on earth do i delete all these entities consistently? So far i've manually droped the tables since this problem started (all entities were deleted fine just few days ago) but thats starting to really annoy me, but i cant figure how to do this.
Thanks!