按照视频讲解配置下列文件:
<class name="Employee" discriminator-value = "0">
<id name="id">
<generator class="native"></generator>
</id>
<property name="name"/>
<discriminator column = "type" type = "int"/>
<many-to-one name="department" column = "depart_id"></many-to-one>
<subclass name = "Skiller" discriminator-value = "1" >
<property name = "skill"/>
</subclass>
<subclass name = "Sales" discriminator-value = "2" >
<property name = "sell"/>
</subclass>
</class>
报错为:
元素类型为 "class" 的内容必须匹配 "(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*,fetch-profile*,resultset*,(query|sql-query)*)"。最后去官网看了一下,按照他的配置改还是报这个错,求各位大神指导hibernate
<class name="Employee" discriminator-value = "0">
<id name="id">
<generator class="native"></generator>
</id>
<property name="name"/>
<discriminator column = "type" type = "int"/>
<many-to-one name="department" column = "depart_id"></many-to-one>
<subclass name = "Skiller" discriminator-value = "1" >
<property name = "skill"/>
</subclass>
<subclass name = "Sales" discriminator-value = "2" >
<property name = "sell"/>
</subclass>
</class>
报错为:
元素类型为 "class" 的内容必须匹配 "(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*,fetch-profile*,resultset*,(query|sql-query)*)"。最后去官网看了一下,按照他的配置改还是报这个错,求各位大神指导hibernate
解决方案 »
- java泛型在jsp页面上的接收
- Hebernet 一个方法中的 删除、增加 先后执行问题
- struts标签bean的用法有哪些?
- 请问有没有人收藏BitTorrent源码(Java版)
- 请教struts2中页面向action提交List对象的问题
- ★请问JPA中如何设置事务的隔离级别?★
- 浏览器后退session问题
- 帮帮忙,UPDATE语句错误!!
- 安装好weblogic后还需要做哪些配置!急用,在线等待
- 求救,关于TOMCAT启动设置问题,谢谢
- spring 注入问题
- 桌面突然多了几个".android"、".m2"、".myeclipse"文件夹,貌似是缓存文件夹,有什么办法删除或更改路径?
public class Employee implements Serializable
{
//id,name,type ,department属性
}public class Skiller
extends Employee implements Serializable
{//skill属性
}public class Sales
extends Employee implements Serializable
{
//sell属性
}
而配置文件package如下,Employee这个类映射emp_table这张表。
<hibernate-mapping package="com.test.demo.bean">
<class name="Employee" table="emp_table" discriminator-value = "0">
<id name="id">
<generator class="native"></generator>
</id>
<property name="name"/>
<discriminator column = "type" type = "int"/>
<many-to-one name="department" column = "depart_id"></many-to-one>
<subclass name = "Skiller" discriminator-value = "1" >
<property name = "skill"/>
</subclass>
<subclass name = "Sales" discriminator-value = "2" >
<property name = "sell"/>
</subclass>
</class>
</hibernate-mapping>而数据库表emp_table表里有id ,name ,type ,depart_id ,skill ,sell这几个字段 ,其中type为0的表示普通employee,1的时候表示skill,2的是的sales。你想好好理解一下,然后再按照我的修改,如果还有问题,继续
我好像没有写extends Employee,下班回去看看