日期:2014-05-19 浏览次数:20715 次
public class Employee {
/**用户标识**/
private Integer id;
/**员工用户名**/
private String username;
/**员工名字**/
private String name;
/**员工密码**/
private String password;
/**电话**/
private Integer phone;
/**最近登入IP**/
private String ip;
/**生日**/
private Date birthday;
}
/**
*组长
***/
public class HeadMan extends Employee{
private Set<Spreader> spreaders;
private Set<Hospital> hospitals;
public class Spreader {
/**所属组长**/
private HeadMan headMan;
/**所属医院部门**/
private Division diversion;
/**推广的关键词**/
private Set<Keyword> keywords;
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Hibernate映射文件的根元素 -->
<hibernate-mapping package="com.heping.oa.entity.main">
<class name="Employee" table="hp_employee">
<cache usage="read-only"/>
<id name="id" type="java.lang.Integer" column="emp_id"><generator class="identity"/></id>
<property name="name" column="emp_name" type="string" not-null="true" unique="true" length="64"/>
<property name="username" column="emp_username" type="string" not-null="true" unique="true" length="64"/>
<property name="password" column="emp_password" type="string" not-null="true" length="64"/>
<property name="phone" column="emp_phone" type="integer" unique="true" not-null="true" length="32"/>
<property name="ip" column="emp_ip" type="integer" length="32" />
<property name="birthday" column="emp_birthday" type="timestamp"/>
<joined-subclass name="com.heping.oa.entity.main.Spreader" table="hp_spreader">
<key column="emp_id"/>
<many-to-one name="headMan" column="headman_id" class="Spreader"></many-to-one>
<many-to-one name="division" column="division_id" class="Division"></many-to-one>
<set name="keywords" inverse="true" table="hp_keyword" cascade="sava-update">
<cache usage="read-write" />
<key column="emp_id" />
<one-to-many class="com.heping.oa.entity.main.Keyword" />
</set>
</joined-subclass>
<joined-subclass name="com.heping.oa.entity.main.HeadMan" table="hp_headman">
<key column="emp_id" />
<set name="spreaders" inverse="true" cascade="delete">
<cache usage="read-write" />
<key column="emp_id" />
<one-to-many class="com.heping.oa.entity.main.Spreader"/>
</set>
<set name="hospitals" inverse="true" cascade="delete">
<cache usage="read-write" />
<key column="emp_id" />
<one-to-many class="com.heping.oa.entity.main.Hospital" /