hibernate - hibernate.cfg.xml 中的错误

标签 hibernate

在我的 hibernate.cfg.xml 中,我收到以下错误:

Referenced file contains errors (http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd). For more information, right click on the message in the Problems View and select "Show Details..."

当我查看“显示详细信息”时,我收到此错误:

The markup declarations contained or pointed to by the document type declaration must be well-formed

这是我的 hibernate.cfg.xml :

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
    <property name="connection.url">jdbc:mysql://localhost/test</property>
    <property name="connection.username">root</property>
    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="connection.password">root</property>
    <property name="hibernate.hbm2ddl.auto">update</property> 
 <property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
    <!--  thread is the short name for
      org.hibernate.context.ThreadLocalSessionContext
      and let Hibernate bind the session automatically to the thread
    -->
    <property name="current_session_context_class">thread</property>
    <!-- this will show us all sql statements -->
    <property name="hibernate.show_sql">true</property>

    <mapping class="com.event.model.Event"/>

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

最佳答案

指示的答案不是正确答案! Jboss 服务器肯定没有停机。

在 OPs 问题中使用的 URL 是 Hibernate 文档站点上列出的内容,但重定向到 http://ww1.sourceforge.com这是一个广告页面持有人 - 去看看。

我找到的带有有效 DTD 的 url 位于:

http://www.jboss.org/dtd/hibernate/hibernate-configuration-3.0.dtd

希望这可以帮助解决此问题的人。

关于hibernate - hibernate.cfg.xml 中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4738817/

相关文章:

Hibernate/JPA 2.0 @OneToOne 关系与可能不存在的匹配行

hibernate - 在Custom AuthenticationProvider中找不到当前线程的 session

java - 如何设置对象的状态

java - 如何处理 hibernate 映射列错误?

java - 具有急切加载问题的 Hibernate 多对多

java - 尝试使用 @ManyToOne 映射来持久化实体

Hibernate通过非ID、唯一标识符获取对象

java - Hibernate 在事务开始函数时卡住

java - 如何以毫秒为单位设置带有数据 JPA 事务性的 Spring boot

java - hibernate 代码中的 session.connection() 类型未定义