您的位置:首页 > 编程语言 > Java开发

解决jpa中Entity类中column注解name属性失效问题

2017-07-13 14:34 429 查看
项目使用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

亲测有效,在配置文件里面改一下配置就好了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  spring jpa
相关文章推荐