解决hibernate中配置文件没有提示的问题

解决方法:

第一种:

有网的时候,只要在配置文件中引入约束,就可以了。
该约束如下:<?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">

注意:这是configuration配置的约束,如果是mapping,则引入mapping的约束,如下:


<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/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的文件夹下

猜你喜欢

转载自blog.csdn.net/qq_38106008/article/details/83550485
今日推荐