错误码:

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

上述错误码nested exception is javax.persistence.PersistenceException可知是实体类实例化的时候报错,所以应该查看实体类是否有注解、字段书写的错误,我的是因为之前做关联,后面去掉了,但注解没有去掉导致,出错代码:

    @NotNull
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
private long userId; 之前是: @NotNull
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
private User user; 正确的是:
  @JoinColumn(name = "user_id", nullable = false)
  private long userId;

hibernate之persistence错误的更多相关文章

  1. 坑爹的Hibernate 映射文件错误提示org.xml.sax.SAXParseException

    今天整整一个上午都在和hibernate做斗争,早上一来,继续昨天的项目开发,发现spring项目不能启动,从错误中看是hibernate错误,多半是hibernate配置有错误,关键是错误提示中显示 ...

  2. hibernate出现 org.hibernate.PropertyNotFoundException: field [departmen] not found on cn.itcast.hibernate.domain.Employee1错误

    hibernate出现 org.hibernate.PropertyNotFoundException: field [departmen] not found on cn.itcast.hibern ...

  3. hibernate报ExceptionInInitializerError错误

    今天在练习hibernate的criteria接口查询时候报了错: java.lang.ExceptionInInitializerError at test.testThisPro.createCr ...

  4. hibernate运行常见错误

    错误一: Exception in thread "main" org.hibernate.MappingException: Could not determine type f ...

  5. org.hibernate.id.IdentifierGenerationException错误解决方法

    org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before ...

  6. Hibernate 之 Persistence

    分享自:  http://blog.csdn.net/jnqqls/article/details/8276059 在我们之前的文章已经了解到,Hibernate的汉语解释叫做冬眠,而这个冬眠我个人理 ...

  7. 解决离线Could not parse configuration:hibernate.cfg.xml错误

    离线使用hibernate tool 生成反向工程,在配置 配置文件完,生成配置文件后,会报出org.hibernate.HibernateException: Could not parse con ...

  8. 配置hibernate出现的错误一

    问题:2011-04-18 11:35:46,734 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] - could not complete sche ...

  9. 【Hibernate】版本错误 org/hibernate/Query : Unsupported major.minor version 52.0

    报错原因:jdk1.7不支持 hibernate的最新版本5.2.0,把hibernate的版本换成5.1.3或更早的版本. 补充:mysql-connector-java-6.0.x也不被hiber ...

随机推荐

  1. 和redis谈一场恋爱(第一天邂逅)

    前几天玩了下Memcache,发现挺好用.知道redis是Memcache的妹妹.我本着大公无私和博大的胸怀,看着redis孤零零的躺在角落里,委实觉得可怜.心里总有个声音在说,你既然已经爱上了Mem ...

  2. Struts学习总结-04 上传文件

    1. upload.jsp <%@ page language="java" import="java.util.*" pageEncoding=&quo ...

  3. 时间日期----java

    Date类 在JDK1.0中,Date类是唯一的一个代表时间的类,但是由于Date类不便于实现国际化,所以从JDK1.1版本开始,推荐使用Calendar类进行时间和日期处理.这里简单介绍一下Date ...

  4. php格式化金额函数分享

    /**  * 格式化金额 *  * @param int $money  * @param int $len  * @param string $sign  * @return string  */ ...

  5. Android学习笔记——ProgressBarHandler

    该工程的功能是实现点击按钮进度条按10%递增,使用的方式是Handler 以下的代码是MainActivity.java中的代码 package com.example.progressbarhand ...

  6. Unity Editor开发

    SerializedObject SerializedObject.Update()更新所有序列化对象的值:SerializedObject.ApplyModifiedProperties()应用序列 ...

  7. 安装glue,用glue批量处理图片的步骤

     glue批量处理图片:http://glue.readthedocs.io/en/latest/quickstart.html#and-why-those-css-class-names 首先需要安 ...

  8. CSS中常见的位置(position)属性

    常用的位置属性列表: position(top.bottom.left.right) .overflow.z-index position用法: 值 描述 relative 相对定位,原位置仍占用空间 ...

  9. Tomcat编码问题及访问软链接文件设置

    Tomcat编码问题及访问软链接文件设置 一.编码问题:让其支持UTF-8格式 修改tomcat中server.xml Connector port=" protocol="org ...

  10. 将图片部署在tomcat/iportWork/uploadFiles中

    将图片部署在tomcat/iportWork/uploadFiles中 1.在将运行的tomcat目录下创建个二级目录iportWork\uploadFiles,如下图: