I'm new to Micronaut and I'm trying to use it with an existing database.
I have an entity with explicit table and column naming, like
@Entity
@Table(name = "TGE040LABEL", schema = "dbo", catalog = "tp_63_dev")
@IdClass(Tge040LabelEntityPK.class)
public class Tge040LabelEntity
and even if I configure physical_naming_strategy
in application.yml like this (and variants, I've tried various values for physical_naming_strategy
... ):
jpa:
default:
entity-scan:
packages:
- 'my.app.domain'
properties:
hibernate:
hbm2ddl:
auto: none
show_sql: true
physical_naming_strategy: "io.micronaut.data.model.naming.NamingStrategies.UpperCase"
dialect: "org.hibernate.dialect.SQLServerDialect"
I still get this error
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'tp_63_dev.dbo.tge040_label'
.
as if my configuration completely gets ignored.
Micronaut version is micronautVersion=1.3.3
Am I missing something?
UPDATE
Before:
jpa:
default:
entity-scan:
packages:
- 'my.app.domain'
properties:
hibernate:
hbm2ddl:
auto: none
show_sql: true
dialect: "org.hibernate.dialect.SQLServerDialect"
After:
jpa:
default:
entity-scan:
packages:
- 'my.app.domain'
properties:
hibernate:
hbm2ddl:
auto: none
show_sql: false
dialect: "org.hibernate.dialect.SQLServerDialect"
physical_naming_strategy: 'org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl'
Just to say, config is in the right place, changes to show_sql
are honored, changes to physical_naming_strategy
are apparently ignored.
Is it actually possible to change the physical_naming_strategy
?
UPDATE 2
Changed my configuration like this:
jpa:
default:
entity-scan:
packages:
- 'my.app.domain'
properties:
hibernate:
id:
new_generator_mappings: false
format_sql: true
globally_quoted_identifiers_skip_column_definitions: true
jdbc:
lob:
non_contextual_creation: true
dialect: org.hibernate.dialect.SQLServerDialect
ddl-auto: none
physical_naming_strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
implicit_naming_strategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
and debugging I get this:
meaning in my opinion that micronaut is actively overriding my configuration, which is at least non-intuitive. Is this behavior documented somewhere?