获取错误:无法解析配置:/hibernate.cfg.xml

时间:2014-12-25 20:48:29

标签: java xml hibernate

我正在尝试使用简单的Java应用程序进行Hibernate并收到错误:

  

线程中的异常" main" org.hibernate.HibernateException:不能   解析配置:/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>
        <!-- Database connection settings -->
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="connection.url">jdbc:mysql://localhost:3306/hibernatedb</property>
        <property name="connection.username">admin</property>
        <property name="connection.password">admin</property>

        <!-- JDBC connection pool (use the built-in) -->
        <property name="connection.pool_size">1</property>

        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>

        <!-- Disable the second-level cache  -->
        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">true</property>

        <!-- Drop the existing tables and create new one -->
        <property name="hbm2ddl.auto">create</property>

        <!-- All the model classes along with their package name -->
        <mapping class="com.techflakes.hibernate.Car"/>

    </session-factory>
</hibernate-configuration>

有人可以帮我查找我的hibernate配置文件有什么问题吗?

1 个答案:

答案 0 :(得分:0)

CacheProvider SPI已经被弃用了相当长的一段时间(自3.3 iirc起)。 org.hibernate.cache.internal.NoCachingRegionFactory是&#34; no caching&#34;等效于新的CacheRegionFactory SPI