Home > Database > Mysql Tutorial > body text

How to Resolve Uppercase Table Name Discrepancy in Spring Boot JPA?

Susan Sarandon
Release: 2024-11-10 09:48:02
Original
242 people have browsed it

How to Resolve Uppercase Table Name Discrepancy in Spring Boot JPA?

Resolving Uppercase Table Name Discrepancy in Spring Boot JPA

When using Spring Boot JPA with Hibernate, you may encounter a situation where the table name in your entity mapping is uppercase (e.g., ITEMS_TO_REGISTER), but the actual table in the database is created in lowercase (items_to_register). This can lead to errors during insert operations.

To resolve this issue without modifying MySQL configuration, you can utilize the physical naming strategy configuration in your application.properties file. By default, Hibernate uses a naming strategy that converts uppercase to lowercase for database identifiers.

For Hibernate 5, you should add the following line to your application.properties file:

spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
Copy after login

This strategy will preserve the uppercase naming convention of your table name in the database. By applying this solution, you can insert new records into your uppercase-named table seamlessly.

The above is the detailed content of How to Resolve Uppercase Table Name Discrepancy in Spring Boot JPA?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template