Soft delete that keeps references

Hi, I am having troubles with implementing soft delete. Problem comes when hibernate tries to delete an entity that has a reference to another entity with not null constraint.
Before hibernate tries to call an update that would perform SQLDelete it tries to set references to null with update statement which fails on database level because of not null constraint.
I found out that the code responsible for this is here:

After hibernate processes the delete for child entities they are added to session.getPersistenceContext().getNullifiableEntityKeys()
and when event for the parent entity arrives hibernate sets their references to null and this violates database constraint.

Is there any way to avoid this behavior? I would prefer to keep the references with soft delete.

Our entities are annotated with

@SQLDelete(sql = "UPDATE {{tablename}} SET deleted = true WHERE id = ? AND version = ?")
@Where(clause = "deleted = false")