以前的資料都是讓再配置文件中加入spring
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyJpaCompliantImpl spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.PhysicalImplicitStrategyStandardImpl
如圖
可是再Hibernate5中好像無效的,仍是沒辦法自動把帶下劃線的字段映射到實體類駝峯命名的屬性上。
,後面發現能夠這樣作,使用spring提供的策略ide
spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy spring.jpa.hibernate.naming.implicit-strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
能夠知足需求。hibernate