多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## 一的配置 ~~~ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <!--作用类和表的映射关系. name:全限定类名. table:表名--> <class name="com.like.bean.Customer" table="cst_customer"> <!--name:属性名. column:字段名--> <id name="cust_id" column="cust_id"> <!--native auto increment 让主键自增长--> <generator class="native"></generator> </id> <!--name:属性名.column:字段名--> <property name="cust_name" column="cust_name" length="20" not-null="true" unique="true"></property> <property name="cust_source" column="cust_source"></property> <property name="cust_industry" column="cust_industry"></property> <property name="cust_level" column="cust_level"></property> <property name="cust_address" column="cust_address"></property> <property name="cust_phone" column="cust_phone"></property> <!--配置一对多--> <set name="linkmans"> <!--外键字段名--> <key column="cust_id"></key> <!--多的一方全限定名--> <one-to-many class="com.like.bean.Linkman"></one-to-many> </set> </class> </hibernate-mapping> ~~~ ## 多的配置 ~~~ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <!--作用类和表的映射关系. name:全限定类名. table:表名--> <class name="com.like.bean.Linkman" table="cst_linkman"> <!--name:属性名. column:字段名--> <id name="lkm_id" column="lkm_id"> <!--native auto increment 让主键自增长--> <generator class="native"></generator> </id> <!--name:属性名.column:字段名--> <property name="lkm_name" column="lkm_name" length="20" not-null="true" unique="true"></property> <property name="lkm_gender" column="lkm_gender"></property> <property name="lkm_phone" column="lkm_phone"></property> <property name="lkm_mobile" column="lkm_mobile"></property> <property name="lkm_email" column="lkm_email"></property> <property name="lkm_position" column="lkm_position"></property> <property name="lkm_memo" column="lkm_memo"></property> <!--配置多对一--> <!--name:一的属性名.class:一的类名.column:一的外键--> <many-to-one name="customer" class="com.like.bean.Customer" column="cust_id"></many-to-one> </class> </hibernate-mapping> ~~~