Fight With Me!!!

导航

many-to-one和one-to-many的配置比较

many-to-one配置:

<many-to-one name="dailyCatalog" column="daily_catalog_id" class="com.tyloo.po.DailyCatalog"  fetch="join" lazy="false" />

one-to-many配置:

<set name="company" fetch="join" lazy="false"> 
        
            <key column="company_id"></key>
            <!--
                这里的column="company_id" 是指明了在company_data表里有一个company_id的列名,是指向company_data表的外键
            -->
            <one-to-many class="com.tyloo.po.CompanyData" />
</set>

posted on 2016-05-28 17:00  nickTimer  阅读(658)  评论(0编辑  收藏  举报