Georg Echterling (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNmMyMDgzZDk4...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16985?atlOrigin=eyJpIjoiNmMyMD...
) HHH-16985 (
https://hibernate.atlassian.net/browse/HHH-16985?atlOrigin=eyJpIjoiNmMyMD...
) Unique keys on unique columns ignore ImplicitNamingStrategy (
https://hibernate.atlassian.net/browse/HHH-16985?atlOrigin=eyJpIjoiNmMyMD...
)
Issue Type: Bug Affects Versions: 6.3.0.CR1 Assignee: Unassigned Created: 24/Jul/2023
05:30 AM Priority: Major Reporter: Georg Echterling (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
When using a custom ImplicitNamingStrategy#determineUniqueKeyName , the following mapping
only partially applies the intended naming scheme:
@Entity
@Table(
uniqueConstraints = { @UniqueConstraint(columnNames = { "ukColumn1" ,
"ukColumn2" }) }
)
class Parent {
@Id
Long id;
String ukColumn1;
String ukColumn2;
@Column(unique = true )
String ukAnnotatedColumn;
@OneToOne
Child child;
}
The unique key applied via @UniqueConstraint correctly uses
ImplicitNamingStrategy#determineUniqueKeyName. The two unique columns ukAnnotatedColumn
(via @Column(unique = true) ) and child (via @OneToOne ) still use a hashed key name and
ignore the ImplicitNamingStrategy.
All unique key names should be consistently generated via
ImplicitNamingStrategy#determineUniqueKeyName.
Afaict, the unique keys for single unique columns get generated in a different phase from
the @UniqueConstraints. When I tried to create a test case for this bug, only the
@UniqueConstraint was available via org.hibernate.mapping.Table.getUniqueKeys(). So I
don’t know how to create a test case for this issue.
(
https://hibernate.atlassian.net/browse/HHH-16985#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16985#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100232- sha1:a133497 )