Don't throw an exception for composite primary keys.

Instead, force the user to set the primary key.
Add a typed exception for setting invalid relationships.