问题:

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命名不起作用的更多相关文章

  1. 异常[PersistenceUnit: default] Unable to build Hibernate SessionFactory

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManage ...

  2. Spring Boot启动 Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not instantiate id generator错误

    开始运行得很好的项目,因为前一天高度了项目结构和名称突然报上面的错误 查了很多网上资料很多解决方案 造成这个错误的原因有很多,例如 1.@Entity 类有变动,无非正常生成对应的数据库. 解决:使用 ...

  3. JPA报错, PersistenceException_Unable to build Hibernate SessionFactory

    javax.persistence.PersistenceException: [PersistenceUnit: TestJPA] Unable to build Hibernate Session ...

  4. Caused by: org.hibernate.HibernateException: Unable to build the default ValidatorFactory

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testAction': ...

  5. 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 ...

  6. 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. ...

  7. 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 ...

  8. 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! 解决办法 ...

  9. 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 ...

随机推荐

  1. webpack之傻瓜式教程

    接触webpack也有挺长一段时间了,公司的项目也是一直用着webpack在打包处理,但前几天在教新人的情况下,遇到了一个问题,那就是:尽管网上的webpack教程满天飞,但是却很难找到一个能让新人快 ...

  2. Android注解使用之通过annotationProcessor注解生成代码实现自己的ButterKnife框架

    前言: Annotation注解在Android的开发中的使用越来越普遍,例如EventBus.ButterKnife.Dagger2等,之前使用注解的时候需要利用反射机制势必影响到运行效率及性能,直 ...

  3. 《LoadRunner12七天速成宝典》签售会2016-12-17北京

    报名地址: http://www.after615.com/actives/s?id=3141&time=1480042829608&sign=9ac8e25e9ab3cf57f613 ...

  4. continue break 区别

    在循环中有两种循环方式 continue , break continue 只是跳出本次循环, 不在继续往下走, 还是开始下一次循环 break  将会跳出整个循环, 此循环将会被终止 count = ...

  5. javaScript中的小细节-script标签中的预解析

    首先介绍预解析,虽然预解析字面意思很好理解,但是却是出坑出的最多的地方,也是bug经常会有的地方,利用好预解析的特性可以解决很多问题,并且提高代码的质量及数量,浏览器在解析代码前会把变量的声明和函数( ...

  6. win10电脑优化

    Windows10必做的优化 --道心 关闭服务 右键点击"此电脑",选择"管理",进入"计算机管理"窗口. 在左侧的菜单选择"服 ...

  7. [转]Java常用工具类集合

    转自:http://blog.csdn.net/justdb/article/details/8653166 数据库连接工具类——仅仅获得连接对象 ConnDB.java package com.ut ...

  8. MyBatis2:config.xml文件

    前言 前一篇文章,讲了MyBatis入门,讲到了MyBatis有两个基本的配置文件,一个用来配置环境信息,一个用来写SQL语句.前者我把它命名为config.xml,config.xml的内容是: & ...

  9. 深入理解IIS的多线程工作机制

    首先让我们来看看IIS里面的这2个数字:最大并发连接数,队列长度.先说这2个数字在哪里看. 最大并发连接数:在IIS中选中一个网站,右键网站名称,在右键菜单中找到并点击[管理网站]->[高级设置 ...

  10. DOM对象模型接口规范中的四个基本接口

    DOM对象模型的四个基本接口 在DOM对象模型接口规范中,有四个基本的接口:Document,Node,NodeList以及NamedNodeMap.在这四个基本接口中,Document接口是对文档进 ...