In the scenario where the ManyToMany association is being saved ... and the ManyToMany bean has not been saved (and does not have an Id) then you can get an error as one of the Id values are null.
The fix is to check the Id value is not null ... and if so throw an exception.
The developer should then fix the application.
Fixed in HEAD.