当我尝试使用以下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子元素。

The documentation有一个示例,并说:


  使用<key>元素声明主键/外键列。

09-04 09:15
查看更多