@OnDelete(action = OnDeleteAction.SET_NULL)
^^^ This is the solution to setting values to null after parent got cascaded, add this above the column and it will be working.