Skip to content
Advertisement

Spring boot JPA insert in TABLE with uppercase name with Hibernate

i have a table entity mapped as :

@Entity
public class ItemsToRegister implements Serializable{

@Id
@Column(name = "ID_ITEM_TO_REGISTER")
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
.....

When i try to insert new record in database, the table name was translated in lowercase as : items_to_register , but my table name is ITEMS_TO_REGISTER How can i fix my problem without change MySql configuration? (my.cnf)

I have in my application.properties file :

spring.jpa.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.naming_strategy = org.hibernate.cfg.ImprovedNamingStrategy

Advertisement

Answer

On hibernate 5, it would be

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

in your application.properties file.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement