誰でもhibernate 4の機能的なcfgファイルの例はありますか? 私がオンラインで見つけることができるすべてのリファレンスはv4未満であり、動作しません。私はここに私のファイルの内容を貼り付けてみましたが、このサイトはhibernate-configurationタグを削除します。ので、ここでhibernate 4の機能hibernate.cfg.xml
が出てくるものです:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://www.hibernate.org/dtd/">
<hibernate-configuration xmlns="http://www.hibernate.org/xsd/hibernate-configuration">
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- Assume test is the database name -->
<property name="hibernate.connection.url">jdbc:mysql://localhost/foampile</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password"></property>
<!-- List of XML mapping files -->
<mapping resource="SiteRecord.hbm.xml"/>
</session-factory>
</hibernate-configuration>
私は
<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">
に変更すると、私はこの例外を取得:
Caused by: org.xml.sax.SAXParseException; lineNumber: 9; columnNumber: 63; Attribute "xmlns" must be declared for element type "hibernate-configuration".
BUTのxmlnsは(のxmlns = "HTTP指定されています://www.hibernate.org/xsd/hibernate-configuration ")
はこれをHiberate 4.1のバグですか?何が価値があるために、私はちょうど(4.1を休止状態のため)、それにスタートを切るために、IntelliJのは、スタブファイルを作成したことになった
問題はDOCTYPEと思われますが、私は何を設定するのか分かりません。私がv3 DTDへの参照を設定していれば、それは再び解析が失敗し、doctypeを含まなければ、hibernate-configurationにxmlns属性がないと言うことになる...私は非常に悲惨です。 LAST 2 HRS – amphibient
Hibernate 4のオンラインドキュメントはDOCTYPEのない例を示しています。 – amphibient
http://docs.jboss.org/hibernate/orm/4.1/devguide/en-US/html/ch01.html#d5e83 – amphibient