hibernate一对多映射文件的配置

hibernate一对多映射文件的配置

hibernate一对多映射文件的配置_第1张图片

其中一个Customer对应多个LinkMan

 

Customer的映射文件 Customer.hbm.xml

"1.0" encoding="UTF-8"?>
mapping PUBLIC 
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
"cn.itcast.domain" >
    <class name="Customer" table="cst_customer" >
        "cust_id"  >
            class="native">
        
        "cust_name" column="cust_name" >
        "cust_source" column="cust_source" >
        "cust_industry" column="cust_industry" >
        "cust_level" column="cust_level" >
        "cust_linkman" column="cust_linkman" >
        "cust_phone" column="cust_phone" >
        "cust_mobile" column="cust_mobile" >
    
        
        
        
         
          
        <set name="linkMens" inverse="true" cascade="delete">
            "lkm_cust_id">
            class="LinkMan" />
        set>
        
    
    class>

LinkMan的映射文件 LinkMan.hbm.xml


mapping PUBLIC 
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
package="cn.itcast.domain" >
    <class name="LinkMan" table="cst_linkman" >
        
            class="native">
        
        
        
        
        
        
        
        
        
        
        
        
          
          
        class="Customer"  >
        
    class>

 

posted @ 2019-04-01 22:00 林汐------ 阅读( ...) 评论( ...) 编辑 收藏

你可能感兴趣的:(hibernate一对多映射文件的配置)