DEV Community

Discussion on: Hibernate Naming Strategies: JPA Specification vs Spring Boot Opinionation

Collapse
 
elmuerte profile image
Michiel Hendriks

Well, let's wrap the table name in quotes. This should keep not only the defined name but also the case.

I strongly advice against doing this. In fact, I strongly advice to stay away from mixed cases event when not using quoted name. The best option is to use lower_snake_case for all your table and column names. (Lower case because it's easier to read.).

While PostgreSQL can properly handle case insensitivity, or case sensitivity. And when desired you can fix it without too much issues.
Other databases cannot. Most notoriously, MySQL/MariaDB. Table names will always case sensitive, even when not created with double quotes around it, on a case sensitive file system. It is something you cannot easily fix.

Collapse
 
aleksey profile image
Aleksey Stukalov • Edited

I strongly advice against doing this. In fact, I strongly advice to stay away from mixed cases event when not using quoted name. The best option is to use lower_snake_case for all your table and column names. (Lower case because it's easier to read.).

Exactly. The same advice is given in the article. However, in case you work with a legacy or third-party database that uses pascal or camel case and that you cannot change, it may become the only way... This is a real-life case from my experience.