<? xml version="1.0" ?> <! DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" > < hibernate-mapping > <!-- Created by the Middlegen Hibernate plugin 2.1 http://boss.bekk.no/boss/middlegen/ http://www.hibernate.org/ --> < class name ="cn.hand.kmoa.persistence.UserInfo" table ="user_info" schema ="test" dynamic-update ="true" dynamic-insert ="true" > < meta attribute ="class-description" inherit ="false" > @hibernate.class table="user_info" schema="test" dynamic-update="true" dynamic-insert="true" </ meta > < id name ="id" type ="java.lang.Integer" column ="ID" > < meta attribute ="field-description" > @hibernate.id generator-class="assigned" type="java.lang.Integer" column="ID" </ meta > < generator class ="assigned" /> </ id > < property name ="loginName" type ="java.lang.String" column ="LoginName" not-null ="true" length ="20" > < meta attribute ="field-description" > @hibernate.property column="LoginName" length="20" not-null="true" </ meta > </ property > < property name ="password" type ="java.lang.String" column ="Password" not-null ="true" length ="20" > < meta attribute ="field-description" > @hibernate.property column="Password" length="20" not-null="true" </ meta > </ property > < property name ="trueName" type ="java.lang.String" column ="TrueName" not-null ="true" length ="10" > < meta attribute ="field-description" > @hibernate.property column="TrueName" length="10" not-null="true" </ meta > </ property > < many-to-one name ="departId" class ="cn.hand.kmoa.persistence.DeptInfo" column ="DepartID" cascade ="all" /> < many-to-one name ="position" class ="cn.hand.kmoa.persistence.PostInfo" column ="Position" cascade ="all" /> < property name ="sex" type ="int" column ="Sex" not-null ="true" length ="2" > < meta attribute ="field-description" > @hibernate.property column="Sex" length="2" not-null="true" </ meta > </ property > < property name ="phone" type ="java.lang.String" column ="Phone" length ="12" > < meta attribute ="field-description" > @hibernate.property column="Phone" length="12" </ meta > </ property > < property name ="mobile" type ="java.lang.String" column ="Mobile" length ="11" > < meta attribute ="field-description" > @hibernate.property column="Mobile" length="11" </ meta > </ property > < property name ="mail" type ="java.lang.String" column ="Mail" length ="50" > < meta attribute ="field-description" > @hibernate.property column="Mail" length="50" </ meta > </ property > < property name ="remark" type ="java.lang.String" column ="Remark" length ="255" > < meta attribute ="field-description" > @hibernate.property column="Remark" length="255" </ meta > </ property > <!-- Associations --> </ class > </ hibernate-mapping > User表与Dept和Post表的主键的一队多关联