开发者

Updation issue in child table using hibernate

I have two tables, A & B having one-to-many relation.

For this I am using List collection inside the parent pojo.

The code of hbm file of A is:

    <bag name="uifUnrecogniseSchoolDetailList" cascade="all">
        <key not-null="true" update="false">
            <column name="uif_detail_state_code"></column>
            <column name="uif_detail_district_code"></column>
            <column name="uif_detail_town_code"></column>
            <column name="uif_detail_ward_code"></column>
        </key>
        <one-to-many class="com.aises.pojo.UifUnrecogniseSchoolDetails"/>
    </bag>

When I insert new records in the table then data is inserted without any problem using saveOrUpate() method. But when I insert same records again then its update the existing record in 开发者_如何学运维the parent table (which is right) but insert new records in the child table, which is wrong. Basically it should be updated the records in the child table like parent table. How can I solve this problem?

Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜