eclipse为hibernate.cfg.xml添加自动提示

好久没有使用hibernate了,今天在使用eclipse3.7打开hibernate.cfg.xml文件时没有自动提示功能,这可不好啊,下面是解决方案。
在hibernate.cfg.xml头部部分如下:
<!DOCTYPE hibernate-configuration PUBLIC
	"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
	"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">


一、解压hibernate-core-4.1.8.Final.jar文件,在org/hibernate目录下找到hibernate-configuration-3.0.dtd文件,将其copy至某个目录下,如D:\Tools\dtd\

二、window->Preferences->XML,然后展开XML,选中[XML Catalog],单机【Add】按钮,选择【Catalog Entity】,在【Location】输入框中输入hibernate-configuration-3.0.dtd文件路径,如:D:\Tools\dtd\hibernate-configuration-3.0.dtd,【Key type】选择‘URI’,【Key】则输入hibernate.cfg.xml头部中出现的‘http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd’,最后单击【ok】按钮,完成!

同理,*.hbm.xml文件也是这样配置即可!

eclipse注释模板

猜你喜欢

转载自songjianyong.iteye.com/blog/1797214