In my application I'm using flyway for data migration, therefore I have defined all tables with all names in UPPER_SNAKE_CASE
(ex. users -> USERS
, candidateGroups -> CANDIDATE_GROUP
). I have provided 2 configurations for different environments: local and docker. On local environment I'm running h2, on Docker I'm running with MariaDB.
Now while running on h2 everything works fine, on MariaDB hibernate is attempts to perform operations on all lower case tables, this results in error:
Caused by: java.sql.SQLException: Table 'application.users' doesn't exist
After some investigations i have tried adding to my application-docker.yml
:
spring:
jpa:
hibernate:
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
This results in capitalization of table names in hibernate:
Caused by: java.sql.SQLException: Table 'application.Users' doesn't exist
I know I can name all tables with annotation @Table(name = "USERS")
and provide names for all columns as well, but this is not my desired solution.
Unfortunately I haven't found any strategy matching my case (I know this shows how to create custom naming strategy but I don't think my case is that uncommon), what naming strategy should I use for my MariaDB config to match my case?