初次配置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. 11 python shutil 模块

      shutil 模块 高级的 文件.文件夹.压缩包 处理模块 1.将文件内容拷贝到另一个文件中 import shutil f1 = open('os_模块.py','r',encoding='ut ...

  2. nodejs文件操作笔记

    nodejs添加了流的概念,通过流操作文件如行云流水,比早前便利畅快多了. 先来第一个例子,我们建一个stream.js文件,里面内容如下: var fs = require("fs&quo ...

  3. 绘制pathway富集散点图

    本文转载自http://www.omicshare.com/forum/forum.php?mod=viewthread&tid=146&extra=page%3D1%26filter ...

  4. java swing:文本框添加滚动条

    有几点要注意: 1.默认的滚动条,仅在输入的文本超过文本框时才会显示..没有超过文本框是不会显示的: 2.设置矩形大小,是在滚动条上设置,而不是在文本框上设置: 示例代码如下: public clas ...

  5. Linux找不到动态库

    首先系统上得有,只是路径问题 可使用ldd查看可执行程序的依赖库 以下都需要超级权限: find / -name libnet.so.9 // 可能在/usr/lib或/usr/local/lib中 ...

  6. mongo嗅探器mongosniff

    mongo嗅探器 在更高版本被mongoreplay取代. 安装: 在Ubuntu直接apt-get install mongodb即包含有. 使用方法 直接--help查看使用方法,一般使用: mo ...

  7. python中的&&及||

    首先说明一下,在python中是没有&&及||这两个运算符的,取而代之的是英文and和or.其他运算符没有变动. 接着重点要说明的是python中的a.any(),我之所以会涉及到这个 ...

  8. c++泛型模板

    模板是C++支持参数化多态的工具,使用模板可以使用户为类或者函数声明一种一般模式,使得类中的某些数据成员或者成员函数的参数.返回值取得任意类型. 模板是一种对类型进行参数化的工具: 通常有两种形式:函 ...

  9. tp中url地址大小写问题

    在tp配置文件中有一个URL_CASE_INSENSITIVE选项,设置为true,表示大小写不敏感. 'URL_CASE_INSENSITIVE' => true

  10. jquery正则判断字符串有几个逗号

    var angelweb="我,你,ta,";var re=/[,,]/g;if(re.test(angelweb)){ var n=angelweb.match(re).leng ...