2 Replies Latest reply on Mar 9, 2004 1:17 PM by mbarragan

    cascade and restrict

    mbarragan

      hi, i have a problem

      im running jboss3.2.2RC3 and mysql 4.1.1

      i have 2 entitybeans in a realtion 1-M,
      the design in the database contain a "ON DELETE RESTRICT" .

      but where i remove the parent entity, the process to remove is:

      -set to null in the foreign key in the child
      -delete the childs

      and the database not throw a exception, because first put null in the child, and after delete the parent.

      i try put a "NOT NULL" in the reference field in the child, and put <insert-before-postcreate>.

      this does not work.

      but i have others entity beans and other relations "ON DELETE CASCADE", it work well.

      really the relation is most complicated(big father-father-son), the relation in "big father-father" is "on delete cascade"

      and the relation in "father-son" is "on delete restrict".

      thanks, and excuse me, i dont speak english.