在Eclipse中创建Hibernate项目时显示错误

时间:2014-09-16 11:07:49

标签: java eclipse hibernate

目前我正在学习hibernate。我正在尝试在eclipse中创建一个关于hibernate的项目。在hibernate.cfg.xml中,它显示警告..“stream not available”

hibernate.cfg.xml中:

  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE hibernate-configuration PUBLIC
 "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
 <hibernate-configuration>
  <session-factory name="studentFactory">
    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="connection.url">jdbc:mysql://localhost/nithya</property>
    <property name="connection.username">root</property>
    <property name="connection.password">root</property>
    <property name="connection.pool_size">5</property>   
    <property name="dialect">org.hibernate.dialect.mysqlDialect</property>  
    <property name="show_sql">false</property>
    <property name="hbm2ddl.auto">update</property>
    <mapping resource="\com\\xmls\\Student.hbm.xml" />
 </session-factory>

警告线是......  “http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd” &GT;

任何人都帮助我克服它,并建议学习和创建hibernate项目的最佳方法.. 提前谢谢..

1 个答案:

答案 0 :(得分:5)

在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">

而不是

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">