项目使用spring boot构建。开发的过程中遇到Spring Data JPA @Column 注解无效。
出现could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet
的错误,这是由于jpa默认才用的命名策略的问题。
直接上解决方案
在application.properties用spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
替换
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
参考http://stackoverflow.com/questions/25283198/spring-boot-jpa-column-name-annotation-ignored
解决jpa中Entity类中column注解name属性失效问题
最新推荐文章于 2024-02-24 16:07:08 发布