给Eclipse中hibernate.cfg.xml配置文件加提示

  1. 在hibernate框架需要的jar包中找到hibernate3.jar,并用压缩软件打开,如图;

    给Eclipse中hibernate.cfg.xml配置文件加提示
  2. 2

    选择org文件夹--打开下一级文件夹

    给Eclipse中hibernate.cfg.xml配置文件加提示
    给Eclipse中hibernate.cfg.xml配置文件加提示
  3. 3

    点击类型,方便找到dtd文件,下拉查看dtd文件,有两个;将这两个文件拖出来到任一文件夹;

    给Eclipse中hibernate.cfg.xml配置文件加提示
  4.  

    如图;

    给Eclipse中hibernate.cfg.xml配置文件加提示
  5.  

    打开你的配置文件hibernate.cfg.xml复制红线标注部分(http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd)

    给Eclipse中hibernate.cfg.xml配置文件加提示
  6.  

    打开eclipse的的window--preferences

    给Eclipse中hibernate.cfg.xml配置文件加提示
  7.  

    在搜索框输入catalog,双击打开,点击 add

    给Eclipse中hibernate.cfg.xml配置文件加提示
    给Eclipse中hibernate.cfg.xml配置文件加提示
  8.  

    点击fileSystem,找到你dtd文件的路径

    给Eclipse中hibernate.cfg.xml配置文件加提示
    给Eclipse中hibernate.cfg.xml配置文件加提示
  9.  

    keytype选项选择uri

    给Eclipse中hibernate.cfg.xml配置文件加提示
  10.  

    key选项粘贴刚才复制的

    http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd这个值,点击ok

    给Eclipse中hibernate.cfg.xml配置文件加提示
    给Eclipse中hibernate.cfg.xml配置文件加提示
  11.  

    如图,点击ok

    给Eclipse中hibernate.cfg.xml配置文件加提示
  12.  

    去eclipse使用,重新打开配置文件,查看效果。

    给Eclipse中hibernate.cfg.xml配置文件加提示
  13.  

    配置mapping文件也是如此,参考上例。

    给Eclipse中hibernate.cfg.xml配置文件加提示
原文地址:https://www.cnblogs.com/cnsdhzzl/p/5775185.html