如何使用 Quarkus 和 Panache 获取蛇格式的表名

And*_*rea 4 hibernate quarkus quarkus-panache

我有带有复合驼峰式名称的 Java 实体,例如EmployeeProject.

我需要将这些实体映射到具有蛇形名称的表上,例如 ,employee_project而不是 Quarkus/Panache 使用的默认值,例如employeeproject

我知道我可以设置自定义表名称,@Entity(name = "employee_project")但我想知道是否有某种应用程序属性可以为我做同样的工作。

Ama*_*har 5

Hibernate 从 Spring 复制了CamelCaseToUnderscoresNamingStrategy

就这样使用就可以了,不用再定义了。

quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
Run Code Online (Sandbox Code Playgroud)