1

As I try to run a program with the following xml mapping file, I get an exception which says :

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)*)".

Why am I getting it ? What could be the reason for this ?

<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>

saplingPro
  • 20,769
  • 53
  • 137
  • 195

1 Answers1

0

The message explains it: the first mandatory sub-element of joined-subclass is key. And you don't have any key sub-element in your file.

The documentation has an example, and says:

Use the <key> element to declare the primary key / foreign key column.

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255