2014-03-04 37 views
0

我的问题基本上是这样的: functional hibernate.cfg.xml for hibernate 4 但我无法发布,因为我没有足够的声望点,而且一个还没有被回答然而。什么doctype用于休眠4

我使用Hibernate 4.3.4和hibernate.cfg.xml文件(在Tomcat 6.0.39中)。在.xml文件的顶部,我有:

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

<hibernate-configuration xmlns="http://www.hibernate.org/xsd/hibernate-configuration" xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-configuration hibernate-configuration-4.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 

当我试图创建配置,我得到以下错误:

org.xml.sax.SAXParseException: Attribute "xmlns" must be declared for element type "hibernate-configuration" 

围绕谷歌搜索后,它似乎喜欢的东西可能是错了我的DOCTYPE,和Hibernate文档我有,示例.cfg.xml文件没有一个DOCTYPE在所有的,所以我想删除它,但后来我得到这个错误:

org.xml.sax.SAXParseException: Document is invalid: no grammar found 

我然后试着看看看我可以如何关闭导致此问题的验证,但我真的宁愿按照正确的方式进行验证。有没有人有休眠版本4的功能hibernate.cfg.xml文件,或者也许知道我在这里做错了什么愚蠢的事情?

谢谢!

回答

0

我发现如果我只是删除一切,它的工作原理。我宁愿让它匹配没有DOCTYPE的实际文档,但现在,我会在它正在工作后像这样离开它。