<p>I Have one entity [Project] that contains a collection of other entities [Questions].</p>
<p>I have mapped the relation with a cascade attribute of &quot;all-delete-orphan&quot;.</p>
<p>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.</p>
<p>When I do <code>session.delete(project)</code> it throws an exception saying that <code>project_id</code> cant be <code>null</code>, but if I remove the <code>not-null</code> constraint to that field, the deletion works nice.</p>
<p>Anyone knows how to solve this?</p>

The delete is occurring on the Project first and cascading to the Question, but the Project delete includes a nulling of the project_id in the Questions (for referential integrity.  You're not getting an exception on the deletion of the Question object, but because the cascade is trying to null the FK in the Question(s).
Looking at "
Java Persistence with Hibernate
", I think that what you really want a cascade type of delete or remove, not delete-orphans.