Ilia Basin (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZDdmZmRlMzVm...
) / Improvement (
https://hibernate.atlassian.net/browse/HHH-16361?atlOrigin=eyJpIjoiZDdmZm...
) HHH-16361 (
https://hibernate.atlassian.net/browse/HHH-16361?atlOrigin=eyJpIjoiZDdmZm...
) Pass current Entity info to Naming Strategy callbacks for columns (
https://hibernate.atlassian.net/browse/HHH-16361?atlOrigin=eyJpIjoiZDdmZm...
)
Issue Type: Improvement Affects Versions: 6.1.7 Assignee: Unassigned Created: 23/Mar/2023
04:33 AM Priority: Major Reporter: Ilia Basin (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
Please consider passing the info about the current entity when calling
ImplicitBasicColumnNameSource.determineBasicColumnName and
PhysicalNamingStrategy.toPhysicalColumnName
The reason is described here:
https://stackoverflow.com/questions/75816005/choice-based-on-current-enti...
(
https://stackoverflow.com/questions/75816005/choice-based-on-current-enti...
)
I know a logical schema of a 3rd-party readonly DB and I want to access it
with Hibernate 6. I used the schema to generate `@Entity` beans for it,
but there's one problem:
Different entities may have identical logical attribute names, but the
physical column names are mapped in a special registry table in the same
DB and they may differ among entities and even for the same entity in
different environments. For instance, on one environment the column is
called "name" and on another it's "name2".
To solve this I'm trying to implement one of these two methods:
*
`org.hibernate.boot.model.naming.ImplicitNamingStrategy.determineBasicColumnName(ImplicitBasicColumnNameSource)`
*
`org.hibernate.boot.model.naming.PhysicalNamingStrategy.toPhysicalColumnName(Identifier,
JdbcEnvironment)`
They are supposed to access the registry table and convert the property
accordingly.
However, the caller does not pass the current entity name to the callbacks
and I don't know for which entity to retrieve the physical column name!
Is there a workaround better than prefixing all like this?
`@Column("MyEntiy$MyProperty")`
See also
https://stackoverflow.com/questions/22639588/hibernate-naming-strategy-pe... (
https://stackoverflow.com/questions/22639588/hibernate-naming-strategy-pe... )
https://stackoverflow.com/questions/10877626/hibernate-column-names-based... (
https://stackoverflow.com/questions/10877626/hibernate-column-names-based... )
(
https://hibernate.atlassian.net/browse/HHH-16361#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16361#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#100219- sha1:0c2c9f2 )