I wanted to give meaningful names to my foreign keys & constraints.
Quite easy, I thought... Just add @ForeignKey on all the @ManyToOne properties that generate the foreign keys, and that's it...
But - This becomes a problem for properties inside reusable @Embeddable classes (e.g. Address)...
When several tables embed the Address component, the @ForeignKey attempts to create the same constraint name in all these tables.
This causes MYSQL to become very angry, because it requires uniqueness among all constraint names in a database.
How can I force a meaningful constraint name on fields of embeddable objects? I couldn't find a way to override the @ForeignKey definition at the 'instantiation' (@Embedded) location...
Any help would be appreciated.
Thanks,
Michael
|