Hibernate 错误的问题
配了好几次的Hibernate,老是在create BeanFactory的时候fail。我是用MyEclipse自带的HIbernate,直接加进去的。
private static final ThreadLocal<Session> threadLocal = new ThreadLocal<Session>();
private static org.hibernate.SessionFactory sessionFactory; private static Configuration configuration = new Configuration();
private static String CONFIG_FILE_LOCATION = "hibernate.cfg.xml";
private static String configFile = CONFIG_FILE_LOCATION; static {
try {
configuration.configure(configFile);//这里导致出错的,删掉这个configFile
sessionFactory = configuration.buildSessionFactory();
} catch (Exception e) {
System.err.println("%%%% Error Creating SessionFactory %%%%");
e.printStackTrace();
}
}
后来自己写另一个HibernateSessionFactory.java,删掉configFile
问题解决了。因为我的hibernate.cfg.xml已经是默认的名字了。
另外要加入log4j、mysql-connector的jar包。
Hibernate 错误的问题的更多相关文章
- idea中Hibernate错误:无法解析表
idea中Hibernate错误:无法解析表 这种情况主要是在idea中使用hibernate自定义注解,idea无法检查数据源 this inspecton controls whether the ...
- Hibernate 错误处理
1. 在处理映射 1 对 n 时,Customer类为 1, Order类为 n,对象关系映射文件中没有错误,<many to one> 也正确,表名通类名. 但是,在执行插入时,发生两个 ...
- Spring集成hibernate错误
八月 25, 2016 7:55:31 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin警告: [SetPropertiesRule ...
- hibernate 错误 could not determine type for
今天配置实体类注解时,出现以下错误: org.hibernate.MappingException: Could not determine type for: com.oneToOne.IdCard ...
- Hibernate错误:javax/persistence/EntityListeners
1. 原文地址:http://heavengate.blog.163.com/blog/static/20238105320127291018026/ 错误信息: hibernate:javax/pe ...
- Hibernate错误——No row with the given identifier exists
错误 是用的是Hibernate自动建立的数据表,在进行数据库操作时,出现错误No row with the given identifier exists 解决 关系数据库一致性遭到了破坏,找到相关 ...
- hibernate错误提示
2016-05-03 09:45:03,275 -- WARN -- org.hibernate.internal.util.xml.DTDEntityResolver.resolveEntity( ...
- Hibernate错误:Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
报错:Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execu ...
- Hibernate错误:Could not bind factory to JNDI
使用hibernate时,将hibernate.cfg.xml中 <session-factory name="SessionFactory">的那么属性去掉即可.因为 ...
- Hibernate错误及解决办法
1.Hibernate 报错:this project is not a myeclipse hibernate project . assuming hibernate 3 cap res:项目名上 ...
随机推荐
- Redis源码分析(adlist)
源码版本:redis-4.0.1 源码位置: adlist.h : listNode.list数据结构定义. adlist.c:函数功能实现. 一.adlist简介 Redis中的链表叫adlist( ...
- Redis源码分析(sds)
源码版本:redis-4.0.1 源码位置:https://github.com/antirez/sds 一.SDS简介 sds (Simple Dynamic String),Simple的意思是简 ...
- Spring一套全通—工厂
百知教育 - Spring系列课程 - 工厂 第一章 引言 1. EJB存在的问题 2. 什么是Spring Spring是一个轻量级的JavaEE解决方案,整合众多优秀的设计模式 轻量级 1. 对于 ...
- 庆祝dotnet6,fastgithub送给你
前言 dotnet6正式发布了,fastgithub是使用dotnet开发的一款github加速器,作为开发者,无人不知github,作为github用户,fastgithub也许是你不可或缺的本机工 ...
- CVE-2020-0796 RCE复现
虽然热度已经过了,之前留的笔记发(水)一篇博客 影响版本 适用于32位系统的Windows 10版本1903 Windows 10 1903版(用于基于x64的系统) Windows 10 1903版 ...
- .net C# 释放内存 例子
namespace myCommon{ public class SysVar { [DllImport("kernel32.dll")] public ...
- FZU ICPC 2020 寒假训练 6 —— 字符串处理
P1603 斯诺登的密码 题目描述 2013年X月X日,俄罗斯办理了斯诺登的护照,于是他混迹于一架开往委内瑞拉的飞机.但是,这件事情太不周密了,因为FBI的间谍早已获悉他的具体位置--但这不是最重要的 ...
- [bzoj1735]泥泞的牧场
考虑木板一定都尽量长,对于每一个污泥,最多只有两种木板会覆盖它(横着和竖的),将这两块木板连边,意味着每一条边两端端点中一定有一个点要被选,即最小点覆盖=最大匹配数. 1 #include<bi ...
- 应用SpringAOP及Tlog工具完成日志链路追踪、收集、持久化
一.痛点 目前我司各系统的日志管理比较原始,使用logback打日志到log文件,虽然有服务管理平台,但记录的日志也仅仅是前置机调用后台系统的出入参,当遇到问题时查日志较为麻烦. 登录VPN-打开服务 ...
- 第一章 初始C语言
第一章 初始C语言 目录 第一章 初始C语言 1. C语言起源 2. 选择C语言的理由 2.1 设计特性 2.2 高效性 2.3 可移植性 2.4 强大而灵活 2.5 面向程序员 3. C语言的应用范 ...