Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get table names in snake case with Quarkus and Panache

I have Java entities with a composite camel case name, e.g., EmployeeProject.

I need to map those entities on tables with snake case names, e.g., employee_project, instead of the default used by Quarkus/Panache, e.g., employeeproject.

I know I can set a custom table name with @Entity(name = "employee_project") but I was wondering if there is some sort of application property which do the same work for me.

like image 763
Andrea Avatar asked Oct 24 '25 14:10

Andrea


1 Answers

Hibernate copied the CamelCaseToUnderscoresNamingStrategy from Spring.

Just use it like this, without defining it again.

quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
like image 95
A0__oN Avatar answered Oct 26 '25 11:10

A0__oN



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!