解决 Springboot Unable to build Hibernate SessionFactory @Column命名不起作用
问题:
Springboot启动报错:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
Springboot 版本 1.4.3.RELEASE
Hibernate相关属性:
spring.jpa.hibernate.ddl-auto=validate
解决:
配置application.properties为
- spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
过程:
配置
- debug=true
- spring.jpa.show-sql=true
日志提示@Column(name)的注解与数据库字段不匹配。发现问题。
原因:
Springboot的JPA由Hibernate实现。Springboot中默认配置的物理命名策略naming.physical-strategy为org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy。把Identifier name用toUnderScoreCase下划线命名规则又转换一次…真是反直觉……
一般大公司都会对常用组件基于开源项目自己去做一套框架去使用,并不能完全发挥Springboot“无配置”整合第三方框架的优点,踩到的坑会比传统Spring深一点…
解决 Springboot Unable to build Hibernate SessionFactory @Column命名不起作用的更多相关文章
- 异常[PersistenceUnit: default] Unable to build Hibernate SessionFactory
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManage ...
- Spring Boot启动 Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not instantiate id generator错误
开始运行得很好的项目,因为前一天高度了项目结构和名称突然报上面的错误 查了很多网上资料很多解决方案 造成这个错误的原因有很多,例如 1.@Entity 类有变动,无非正常生成对应的数据库. 解决:使用 ...
- JPA报错, PersistenceException_Unable to build Hibernate SessionFactory
javax.persistence.PersistenceException: [PersistenceUnit: TestJPA] Unable to build Hibernate Session ...
- Caused by: org.hibernate.HibernateException: Unable to build the default ValidatorFactory
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testAction': ...
- spring3+structs2整合hibernate4时报org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void sy.dao.impl.UserDaoImpl.setSessionFactory(org.hibernate.SessionFactory);
今天在spring3+structs2整合hibernate4时报如下错误,一直找不到原因: org.springframework.beans.factory.BeanCreationExcepti ...
- SSH框架-Caused by: org.hibernate.MappingException: column attribute may not be used together with <column> subelement
昨晚修改了一些表关系,在相关的hbm.xml文件中做了改动,今天早上起来启动tomcat后,发现项目启动不了,控制台报错: 2015-6-14 9:09:42 org.apache.catalina. ...
- eclipse升级Android SDK Tool版本到25.2.5后运行项目报错Unable to build: the file dx.jar was not loaded from the SDK folder
概述 由于最近通过SDK-Manager更新了build-tools,当要用到dx.jar这个包时,自动调用最新版本Android SDK build-tools中dx.jar,但是运行android ...
- Unable to build: the file dx.jar was not loaded from the SDK folder
eclipse 运行 android 时失败了,提示 Unable to build: the file dx.jar was not loaded from the SDK folder! 解决办法 ...
- Unknown error: Unable to build: the file dx.jar was not loaded from the SDK folder!
Eclipse 编译没问题,但是运行就出现这个报错:Unknown error: Unable to build: the file dx.jar was not loaded from the SD ...
随机推荐
- Html Agility Pack 解析Html
Hello 好久不见 哈哈,今天给大家分享一个解析Html的类库 Html Agility Pack.这个适用于想获取某网页里面的部分内容.今天就拿我的Csdn的博客列表来举例. 打开页面 用Fir ...
- NodeJs之child_process
一.child_process child_process是NodeJs的重要模块.帮助我们创建多进程任务,更好的利用了计算机的多核性能. 当然也支持线程间的通信. 二.child_process的几 ...
- 学习AOP之认识一下Spring AOP
心碎之事 要说知道AOP这个词倒是很久很久以前了,但是直到今天我也不敢说非常的理解它,其中的各种概念即抽象又太拗口. 在几次面试中都被问及AOP,但是真的没有答上来,或者都在面上,这给面试官的感觉就是 ...
- 在SQL2008查找某数据库中的列是否存在某个值
在SQL2008查找某数据库中的列是否存在某个值 --SQL2008查找某数据库中的列是否存在某个值 create proc spFind_Column_In_DB ( @type int,--类型: ...
- Java多线程基础——对象及变量并发访问
在开发多线程程序时,如果每个多线程处理的事情都不一样,每个线程都互不相关,这样开发的过程就非常轻松.但是很多时候,多线程程序是需要同时访问同一个对象,或者变量的.这样,一个对象同时被多个线程访问,会出 ...
- salesforce 零基础学习(六十二)获取sObject中类型为Picklist的field values(含record type)
本篇引用以下三个链接: http://www.tgerm.com/2012/01/recordtype-specific-picklist-values.html?m=1 https://github ...
- 【SQLServer】记一次数据迁移-标识重复的简单处理
汇总篇:http://www.cnblogs.com/dunitian/p/4822808.html#tsql 今天在数据迁移的时候因为手贱遇到一个坑爹问题,发来大家乐乐,也传授新手点经验 迁移惯用就 ...
- SQL Server-聚焦查询计划Stream Aggregate VS Hash Match Aggregate(二十)
前言 之前系列中在查询计划中一直出现Stream Aggregate,当时也只是做了基本了解,对于查询计划中出现的操作,我们都需要去详细研究下,只有这样才能对查询计划执行的每一步操作都了如指掌,所以才 ...
- 玩转spring boot——MVC应用
如何快速搭建一个MCV程序? 参照spring官方例子:https://spring.io/guides/gs/serving-web-content/ 一.spring mvc结合thymeleaf ...
- Kafka副本管理—— 为何去掉replica.lag.max.messages参数
今天查看Kafka 0.10.0的官方文档,发现了这样一句话:Configuration parameter replica.lag.max.messages was removed. Partiti ...