Hibernate will set those ID's to null if the references are null at the time of saving. So something like this:
A instanceOfA = ...;
instanceOfA.setRelease(null);
instanceOfA.setTask(null);
session.save(instanceOfA);
should result in you having a row in the A table that has NULL
for both release_id
and task_id
.
This is detailed very lightly in the Hibernate docs:
With the exception of collections, all built-in Hibernate types
support null semantics.
ie, if something is null in Java, then it will be null in the database.