Hibernate一對多雙向、單向

private Set<PresentProductSociety> PPSSet;//實體屬性

<set name="PPSSet">

            <comment>一方配置</comment>

            <key column="society_id"/>

            <one-to-many class="cn.pojo.PresentProductSociety"/>

        </set>


 private Society society;//實體屬性

 <many-to-one name="society" class="cn.pojo.Society" fetch="select">

            <column name="society_id">

            <comment>多方配置</comment>

            </column>

        </many-to-one>


////////////////////////////以下是單向,也就是只需要配置一部分/////////////////

 private Society society;//實體屬性

 <many-to-one name="society" class="cn.pojo.Society" fetch="select">

            <column name="society_id">

            <comment>多方配置</comment>

            </column>

        </many-to-one>



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章