簡體   English   中英

我的休眠映射文件未通過驗證測試,嘗試運行該程序時出現異常。為什么?

[英]My hibernate mapping file doesn't pass the validation test and I get an exception as I try to run the program.Why is that?

當我嘗試使用以下xml mapping文件運行程序時,出現一個異常:

org.xml.sax.SAXParseException: The content of element type "joined-subclass"
must match "(meta*,subselect?,synchronize*,comment?,tuplizer*,key,
(property|many-to-one|one-to-one|component|dynamic-
component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,
joined-subclass*,loader?,sql-insert?,sql-update?,sql-delete?,resultset*,
(query|sql-query)*)".

我為什么得到它? 這可能是什么原因?

<class name="pojo.Parent" table="student_detail">
  <id name="roll_number">
      <generator class="increment" />
  </id>
  <property name="s_name" />
  <joined-subclass name="pojo.Child" table="child">

      <property name="english" />
      <property name="hindi" />
      <property name="punjabi" />
      <property name="total" />
  </joined-subclass>

該消息說明了這一點: joined-subclass的第一個強制性子元素是key 而且您的文件中沒有任何key子元素。

該文檔有一個示例,並說:

使用<key>元素聲明主鍵/外鍵列。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM