hibernate - can not delete the entity using session.delete() -


I have some unit in my application, and some of them are many organizations, when I try to delete them I get this error: "Can not delete or update a base line: A foreign key constraint ....".

This example is:

  class work {@ OneToMany (mapped = "jobs") list & lt; Work & gt; Step; } Classroom work {@ManyToOne (cascade = CascadeType.ALL) Working tasks; @ManyToMany (Cascade = Cascade Type.ALL) list & lt; Operator & gt; Operators} class operator {@ManyToMany (mapped = operator list) & gt; Work & gt; Step; }   

When I want to delete a task object, I get an exception.

Why? I want to delete the related rows in the Tasks object, and T_tscstep_t_parator.

How to do it?

try it,

  class work {@OneToMany (cascade = Cascade type.AL) list & gt; Work & gt; Step; }   

This will also remove the entry related to the workspace.

Comments