Generate foreign key constraint names

Description

We're using Hibernate's SchemaExport tool to generate the database schema SQL script.

By default, this tool names foreign key constraints as follows:
FK + hash(table name) + hash(column name)

This guarantees the foreign key constraint name uniqueness, but really isn't meaningful when used in foreign key constraint violation error messages (e.g.: FK78191C2991B).

It isn't possible to use a custom NamingStrategy, like for table and column names,
but it is still possible to override the default name by adding a 'foreign-key' attribute on the following elements of the Hibernate mapping file (See Hibernate Reference chapter 15): <one-to-one>, <many-to-one>, <key>, and <many-to-many>.

I think AndroMDA could make a good use of association-end names to generate meaningful unique names for foreign key constraints or use a naming pattern like: fk + table name + column name.

Environment

AndromMDA RC1 latest build

Status

Assignee

MichaelM

Reporter

Johnny Macchione

Labels

None

Fix versions

Affects versions

3.0-M3

Priority

Minor
Configure