Mixing @UniqueConstraint with @Column(unique=true) fails to use the @UniqueConstraint to generate the unique key

Description

Hello,

I have the following classe:

Depending on whether unique=true is set in getLogin's @Column, I have the following result in the generated statement :

1. getLogin with unique = true:

2. getLogin with unique = false

While the javadoc for unique explains that it is a shortcut for the UniqueConstraint annotation I would rather have Hibernate to:

1. Either fails (eg: you can't mix UniqueConstraint with unique=true)
2. Either use the name from UniqueConstraint

In the example here, Hibernate somehow determined that my UniqueConstraints correspond to something already existing (otherwise I would have two constraints, UK_6iua9a9q6jbsdakwv83vo40rm and uk_usr_login).

Environment

None

Assignee

Chris Cranford

Reporter

NoDataFound

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure