Do you mean HQL bulk update? try it
UPDATE myEntity e SET e.myProperty = null WHERE ...
You can also use the parameterized version above
UPDATE myEntity e SET e.myProperty = :param WHERE ...
In your code:
int updatedEntities = session.createQuery(updateQueryHQL) .setString( "param", myValue ) // or .setString( "param", null ) .executeUpdate();
See the documentation for more details.
If you are not doing bulk updates, you should simply set your property to NULL and save the object in normal mode.
ChssPly76
source share