简体   繁体   中英

what is wrong with the hibernate mapping xml?

As I validate the following xml , I get the following error :

The content of element type "class" must match "(meta*,subselect?,cache?,
synchronize*,comment?,tuplizer*,(id|composite-id),
discriminator?,natural-id?,(version|timestamp)?,
(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map
|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|
union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,
(query|sql-query)*)". [16]

What could be the reason I am getting this ?

 <hibernate-mapping>
  <class name="pojo.Parent" table="student_detail">
      <id name="roll_number">
          <generator class="increment" />
      </id>
      <property name="s_name" />
      <discriminator column="discrim" type="string" />
      <subclass name="pojo.Child">
          <property name="hindi" />
          <property name="english" />
          <property name="punjabi" />
          <property name="total" />
      </subclass>
  </class>    
  </hibernate-mapping>

The order of the elements is wrong.

Put the discriminator immediately after the id .

Take a look at the example here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM