Springboot jpa @ Column naming case problem and its solution
- 2021-12-04 10:03:40
- OfStack
Directory Springboot jpa @ Column naming case 1. Problem 2. Solution @ Column case specification
Springboot jpa @ Column naming case
1. Problems
Hump naming will be automatically converted to database underlining naming, and name specifying @ Column will not work
Examples:
@Column(nullable = false,name = "resolvedDate")
private Timestamp resolvedDate;
resolvedDate will be converted to resolved_date
2. Solutions
Add a naming convention
Add the jpa attribute to application. properties:
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
@ Column Case
@ Column is used to map database fields, which are not case sensitive.
Specification
Database fields, in serpentine, underlined form.
@Column(name = " user_id " ) Serpentine, associated