ImplicitNamingStrategy not used when @Column(unique=true)

Description

I implemented my own naming strategy:

but I can't get it called when using @Column/@JoinColumn with unique=true.

The resulting constraint/index SQL statement is always something like

when I expect

Let me know if you need a test-case (this is far too simple to verify).

Environment

Hibernate 5.2.2 MySQL 5.7

Activity

Show:
Marcelo Glasberg
June 28, 2017, 4:46 PM

Note: ImplicitNamingStrategy names the constraint through @UniqueConstraint, but @Column(unique = true) generates a random name (e.g. UK_3u5h7y36qqa13y3mauc5xxayq).

If you search for "UK_" in Hibernate code you find all places where the naming is hardcoded. It should be easy to change this to use the implicit naming strategy.

Arthur Gregório
December 26, 2018, 1:37 PM

Is there any plan to solve this problem?

Overriding Constraint class is not good way to achieve this functionality

Assignee

Andrea Boriero

Reporter

Michele Mariotti

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure