Rules when Using Foreign Keys
- Foreign key relationships are allowed on entity classes only.
- Fields referenced by a foreign key will be set to unique, as this is required by some databases.
- If the foreign key references the primary key of another entity, a redundant unique clause will not be generated by the generator, as the primary key is already unique.
- Foreign keys cannot be specified on subclass entities. The relationship should be specified using the actual base entity classes themselves.