简体   繁体   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?

As I try to run a program with the following xml mapping file, I get an exception which says : 当我尝试使用以下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)*)".

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>

The message explains it: the first mandatory sub-element of joined-subclass is key . 该消息说明了这一点: joined-subclass的第一个强制性子元素是key And you don't have any key sub-element in your file. 而且您的文件中没有任何key子元素。

The documentation has an example, and says: 该文档有一个示例,并说:

Use the <key> element to declare the primary key / foreign key column. 使用<key>元素声明主键/外键列。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我尝试运行我的程序时,视图无法打开? - View Doesn't Open When I Try To Run My Program? 当我尝试运行程序时,GUI无法加载,我无法弄清楚为什么 - When i try to run my program, the GUI won't load and I can't figure out why 创建休眠映射XML文件时,为什么会出现Nullpointer异常? - Why do I get Nullpointer exception when I create a hibernate mapping XML file? 当我尝试运行它时,为什么我的程序会冻结/崩溃? - Why does my program freeze/crash when i try to run it? 配置中的映射元素未指定属性尝试在Hibernate中运行项目时发生错误 - Mapping element in configuration specifies no attributes Error occurred when i try to run my project in Hibernate jQuery / Spring:当我尝试使用@ResponseBody传递源代码时,为什么我的自动填充功能无法正常工作? - Jquery/Spring: Why doesn't my autocomplete work when I try to pass in source using @ResponseBody? 我不明白为什么我的 Java 程序无法运行 - I don't understand why my Java program doesn't run 如何处理org.hibernate.exception.ConstraintViolationException,我使用try catch不起作用 - how to handle org.hibernate.exception.ConstraintViolationException, I using try catch doesn't work 为什么当我尝试在servlet映射开始时不带“ /”的情况下出现异常 - Why do I get an exception when I try a servlet mapping without the “/” in the beginning 收到org.hibernate.InvalidMappingException:尝试运行程序时无法读取xml - getting org.hibernate.InvalidMappingException: unable to read xml when I try to run my program
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM