解决方法:
第一种:有网的时候,只要在配置文件中引入约束,就可以了。该约束如下:
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
注意:这是configuration配置的约束,如果是mapping,则引入mapping的约束,如下:
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
第二种:不能上网 的时候,则需要导入该约束的文件
这里只以myeclipse为例
点击windows,再点击preferences,在出现的窗口中搜索xml.catalog,在右侧窗口中点击add,在location中选择约束文件的位置,在key type中选择URL,
在key中填写约束文件的网络地址,configuration是:http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd。
如果是mapping的,则是:http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd
最后点击确定。
ps:约束文件的位置在:所下载的hibernate-relaese-5.0.12.Final文件夹中,
project--->hibernate-core--->src--->main--->resources--->org--->hibernate的文件夹下