---
title: "Hibernate一对多使用非主键关联设置"
author: "colky"
date: "2008-07-15T15:24:12Z"
tags: []
slug: "hibernate"
draft: false
lastmod: "2008-07-15T15:24:12Z"
id: 214998
url: "https://colky.iteye.com/blog/214998"
---

A
<property name="componentpartId" type="long" not-null="true" column="p_componentpart_id"/> 

    <set name="b" lazy="true" cascade="none" fetch="join">
        <key column="p_componentpart_id" property-ref="componentpartId" />
        <one-to-many class="B" />
    </set>



B


    <many-to-one name="a" class="A" column="p_componentpart_id" property-ref="componentpartId" cascade="none" ....../>