IntellijでHibernatehbm.xmlファイルを生成しようとしていますが、実行時にこの問題が発生します。
ott 10, 2013 11:51:43 AM org.hibernate.internal.util.xml.ErrorLogger warning ERROR: HHH000198: Warning parsing XML (4) : schema_reference.4: lettura del documento di schema "http://www.hibernate.org/xsd/hibernate-mapping/hibernate-mapping-4.0.xsd" non riuscita perché 1) non è stato possibile trovare il documento; 2) non è stato possibile leggere il documento; 3) l'elemento radice del documento non è <xsd:schema>.
...
ERROR: HHH000196: Error parsing XML (2) : cvc-elt.1: impossibile trovare la dichiarazione dell'elemento "hibernate-mapping".
Exception in thread "main" org.hibernate.InvalidMappingException: Unable to read XML
生成されたxmlファイルは次のとおりです。
<?xml version='1.0' encoding='utf-8'?>
<hibernate-mapping xmlns="http://www.hibernate.org/xsd/hibernate-mapping"
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping http://www.hibernate.org/xsd/hibernate-mapping/hibernate-mapping-4.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<class name="it.blackcat.hibernatedemo3.hdao.Actor" table="actor" schema="" catalog="sakila">
<id name="actorId" column="actor_id"/>
<property name="firstName" column="first_name"/>
<property name="lastName" column="last_name"/>
<property name="lastUpdate" column="last_update"/>
</class>
hibernate-mappingの何が問題になっているのでしょうか?ありがとう!
編集:
@LaGrandMereはDOCTYPEの問題を解決しましたが、Intellijが間違ったXMLを生成する理由はありますか?
きみの
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping http://www.hibernate.org/xsd/hibernate-mapping/hibernate-mapping-4.0.xsd"
よくない。
試してみてください:
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加