2

Sorry for may English. I have 4 tables:

**t1**
id

**t2**
id
t1_id

**t3**
id
t2_id

**t4**
id
t1_id
t2_id

In t2 entity I use it:

@OneToMany(fetch=FetchType.LAZY, cascade = {CascadeType.ALL}, mappedBy="t2")
Set<t3> t3Set;

@OneToMany(fetch=FetchType.LAZY, cascade = {CascadeType.ALL}, mappedBy="t2")
Set<t4> t4Set;

If i delete t2 entity, then t3-4 also to be deleted. But it is not working with multiple levels. How to delete t1?

zerg
  • 255
  • 1
  • 3
  • 17
  • it is deleting value from t3 not from t4 right ? – Arjun Prajapati Apr 15 '15 at 15:24
  • No. If I delete `t1`, then should be deleted `t4, t3, t2`. I can to add `t1_id` in `t3`. But how can i to set the sequence of removal. – zerg Apr 15 '15 at 15:38
  • from table t4 remove t1 and t2 and add t3 it will work – Arjun Prajapati Apr 15 '15 at 15:46
  • You did not understand me. I want to delete a row from `t1`. But it is not working as with `t2`. Need to record from the tables were removed in sequence. The sequence of removal t1: t4-t3-t2-t1. – zerg Apr 15 '15 at 18:02

0 Answers0