初次配置hibernate在myeclipse上:

出现三个问题,怎么都不好使,比对代码,没有问题,查看路径还是没有问题:

1、org.hibernate.HibernateException: /hibernate.cfg.xml not found

路径问题:

说找不到我的hibernate.cfg.xml,比对之后发现没有问题:

配置好后应该是这样的,然后mapping中要使用当前的文件路径,把之前的都删了。

2、This project is not a MyEclipse Hibernate Project. Assuming Hibernate 3 capablites for the configuration editor.;

显示这个没做改动,最后自然好使,有的人说还可以配置下:

myeclipse-->add hibernate capabilites -->next-->hibernate config file --> existing -->选择现有工程存在的hibernate配置文件--> next --> 不生成factory class --> end

更改后我的还是无效,大家可以试试也许你有效。

3、'hibernate.dialect' must be set when no Connection avalable

无奈下我把例子导入了工程中,然后运行,曝出了错误是这个,这个错误说我没有对其进行语言识别的配置,然后我把下边这句加了进去

<property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>结构如图:

然后所有问题都消失了。

4、在数据库中要提前建立好

<property name="connection.url">
jdbc:mysql://localhost:3306/liuyang_person_hibernate
</property>

名字为liuyang_person_hibernate(我的是这个),这个的数据库,然后写好测试类,运行一下就好使了

5、最终结果

org.hibernate.HibernateException: /hibernate.cfg.xml not found等三个问题的更多相关文章

  1. 问题Initial SessionFactory creation failed.org.hibernate.HibernateException: /hibernate.cfg.xml not found解决方法

    问题Initial SessionFactory creation failed.org.hibernate.HibernateException: /hibernate.cfg.xml not fo ...

  2. hibernate 使用 hibernate tool 生成配置文件和实体类

    安装Hibernate插件 下载所需的Hibernatetools  http://www.hibernate.org/6.html 将下载得到的文件解压得到的features和plugins文件夹, ...

  3. org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml

    org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml at org.hibernate ...

  4. hibernate hibernate.cfg.xml component 组件

    1.为什么使用component组件? 当一个表的列数目比较多时,可以根据属性分类,将一个java对象拆分为几个对象. 数据库还是一张表,不过有多个对象与之对应. 2.实例 2.1 Java 对象: ...

  5. 关于Could not parse configuration: /hibernate.cfg.xml的问题

    第一次在eclipse上配置hibernate,问题百出啊,比如下面的org.hibernate.HibernateException: Could not parse configuration: ...

  6. hibernate.cfg.xml配置(Oracle+c3p0)

    说明:数据库:Oracle10g:连接池:c3p0 结构: 一.配置hibernate.cfg.xml <?xml version="1.0" encoding=" ...

  7. Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable t

    spring与hibernate整合然后出现如下错误: org.springframework.beans.factory.BeanCreationException: Error creating ...

  8. org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xm

    org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xm 检查jar包是否正确以及配置的xm ...

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

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

随机推荐

  1. java常用的Utils写法

    Utils: 获取年龄 属性文件获取 BeanCopy    分页 MapUtils 获取年龄: /** * 根据传入的日期计算年龄,因时间戳是从1970年开始计算的 * @param date * ...

  2. JavaScript中有三个可以对字符串编码的函数,分别是: escape(),encodeURI(),encodeURIComponent()

    JavaScript中有三个可以对字符串编码的函数,分别是: escape,encodeURI,encodeURIComponent,相应3个解码函数:unescape,decodeURI,decod ...

  3. PAXOS/RAFT理解

    PAXOS学习记录 前提: 信息准确无篡改,通信环境可信 目的: 解决多结点间一致性问题(集群中一个修改或者申请成为主结点的提议) 主要角色: Proposer :提出议案(同时存在一个或者多个,他们 ...

  4. 【转载】 Java并发编程:深入剖析ThreadLocal

    原文链接:http://www.cnblogs.com/dolphin0520/p/3920407.html感谢作者的辛苦总结! Java并发编程:深入剖析ThreadLocal 想必很多朋友对Thr ...

  5. html file 文件批量上传 以及碰到的一些问题提

    //javascript 代码 $("#submite").click(function (evt) { var arrayTr = $("#datatables&quo ...

  6. Session的作用和使用场景

    1.session何时被创建? 客户首次访问服务器时,回话session对象被创建并分配一个唯一的Id,同时id号发送到客户端,并存入cookie,使得客户端session对象和服务器端一致. 2.如 ...

  7. C#四舍五入说明

    string.Format("{0:N2}", d) 与 Math.Round(d, 2).ToString() 不总是相等 string.Format("{0:N2}& ...

  8. 树莓派 Zero W+温度传感器DS18B20

    树莓派 Zero W+温度传感器DS18B20 作者:陈拓chentuo@ms.xab.ac.cn 2018.05.28/2018.06.01 0.  概述 用树莓派 Zero W读取DS18B20温 ...

  9. java 包的命名规范

  10. MapReduce超时原因(Time out after 300 secs)

    目前碰到过三种原因导致 Time out after 300 secs. 1. 死循环 这是最常见的原因.显式的死循环很容易定位,隐式的死循环就比较麻烦了,比如正则表达式.曾经用一个网上抄来的邮箱正则 ...