[英]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.