Skip to content
Advertisement

Spring Boot + JPA : Column name annotation ignored

I have a Spring Boot application with dependency spring-boot-starter-data-jpa. My entity class has a column annotation with a column name. For example:

JavaScript

SQL generated by this created test_name as the columns name. After looking for a solution I have found that spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy solved the problem (column name is taken from column annotation).

Still, my question is why without naming_strategy set to EJB3NamingStrategy JPA is ignoring column annotation? Maybe hibernate dialect has something to do with it? I’m connecting to MS SQL 2014 Express and my logs contain:

JavaScript

Advertisement

Answer

For Hibernate 5, I solved this issue by adding the following lines in my application.properties file:

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