使用Junit测试Hibernate.hbm.xml报错。
第一句报错:Configuration configuration=new Configuration().configure("/hibernate.cfg.xml");
下面是hibernate.cfg.xml源码:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- 连接数据库的基本参数 -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/hibernate</property>
<property name="connection.username">root</property>
<property name="connection.password">123123</property>
<!-- 配置Hibernate的方言 -->
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- 打印sql (可选)-->
<property name="hibernate.show_sql">true</property>
<!-- 格式化sql(可选) -->
<property name="hibernate.dialect">true</property>
<mapping resource="com/demo1/Customer.hbm.xml"/>
</session-factory>
</hibernate-configuration>