相关疑难解决方法(0)

使用http://www.hibernate.org/dtd的Hibernate问题

我目前在我的hibernate配置文件中使用http://hibernate.sourceforge.net作为我的命名空间,这给了我这些警告:

公认的过时的hibernate名称空间 http://hibernate.sourceforge.net/.请改用名称空间 http://www.hibernate.org/dtd/.请参阅Hibernate 3.6迁移指南!

所以我尝试将hibernate.cfg.xml和所有其他*.hbm.xml文件切换到使用http://www.hibernate.org/dtd.然而,当我尝试使用eclipse中的hibernate工具生成代码时,我收到以下错误消息(代码生成与其他命名空间一起工作正常):

org.hibernate.HibernateException:无法解析配置:C:\ dev\workspace\DataLoad\hibernate.cfg.xml无法解析配置:C:\ dev\workspace\DataLoad\hibernate.cfg.xml
org.dom4j.DocumentException: www.hibernate.org嵌套异常:www.hibernate.org www.hibernate.org嵌套异常:www.hibernate.org org.dom4j.DocumentException:www.hibernate.org嵌套异常:www.hibernate.org www.hibernate.org嵌套异常:www.hibernate.org

这是我的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/findata?tcpKeepAlive=true
        </property>
        <property name="connection.username">root</property>
        <property name="connection.password">xxxxxxxx</property>

        <property name="connection.pool_size">2</property>
        <property name="show_sql">true</property>
        <property name="dialect">
            org.hibernate.dialect.MySQLDialect
        </property>
        <property name="current_session_context_class">thread</property>
        <property name="cache.provider_class">
            org.hibernate.cache.NoCacheProvider
        </property>

        <mapping resource="conf/Alert.hbm.xml" />
        <mapping resource="conf/Entity.hbm.xml" />
        <mapping resource="conf/FactData.hbm.xml" />
        <mapping resource="conf/TimeEvent.hbm.xml" />
        <mapping resource="conf/User.hbm.xml" /> …
Run Code Online (Sandbox Code Playgroud)

java eclipse hibernate

3
推荐指数
1
解决办法
2万
查看次数

标签 统计

eclipse ×1

hibernate ×1

java ×1