您的位置:首页 > 编程语言 > Java开发

为 eclipse 的 hibernate 配置文件(*.hbm.xml)加上自动提示功能

2013-01-28 18:52 691 查看
在编辑 *.hbm.xml 文件时,myeclipse 带有自动提示功能,但 eclipse 是没有自动提示功能的。需要自己手工加上:

          1、打开项目中任意一个 *.hbm.xml 文件,看一下文件头,形如以下:

[html]
view plaincopyprint?

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

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


          找到 http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd(视 hibernate 版本不同有所不同,作者使用的是 hibernate3.6.7)。

          2、将项目中用到的 hibernate3.jar 解压缩,找到解压缩后的 org 文件下的 hibernate 文件下的 hibernate-mapping-3.0.dtd 文件。

          3、eclipse -> Window -> Preferences -> Web and XML -> XML Catalog,选择 XML Catalog Entries 的 Add... 按钮,在弹出的 Add XML Catalog Entry 对话框里,Location 里选择第二步里得到的 hibernate-mapping-3.0.dtd,Key Type 选择 URI,Key 里输入第一步里得到的http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd。OK。

          再打开 eclipse 中的 *.hbm.xml 文件,编辑时就可以像 myeclipse 中那样拥有自动提示功能了。

转自http://blog.csdn.net/defonds/article/details/6723192
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: