在 Hibernate 4 中,我发现(对我来说是新的)使用 XSD 模式而不是 DTD 的可能性。
<hibernate-mapping xmlns="http://www.hibernate.org/xsd/hibernate-mapping"
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping hibernate-mapping-4.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
但是架构位置无效,并且在初始化过程中出现错误。
有人知道 Hibernate 4 中的 XSD 有什么问题吗?
请您参考如下方法:
<hibernate-mapping xmlns="http://www.hibernate.org/xsd/hibernate-mapping"
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping classpath://org/hibernate/hibernate-mapping-4.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" package="acme.foo.bar"/>
试试这个,它应该工作得更好。




