I Have one entity [Project] that contains a collection of other entities [Questions].
I have mapped the relation with a cascade attribute of "all-delete-orphan".
In my DB the relation is mapped with a project_id (FK) field on the questions table. this field cannot be null since I don't want a Question without a Project.
When I do
session.delete(project) it throws an exception saying that
project_id cant be
null, but if I remove the
not-null constraint to that field, the deletion works nice.
Anyone knows how to solve this?