Throw exception when value is null and allowEmpty is false
Implement allowEmpty for BelongsTo. This also fixes BelongsTo being a subclass from HasOne.