基于外键关联的单向一对多关联是一种很少见的情况,并不推荐使用。
<class name="Person"><id name="id" column="personId"><generator class="native"/></id><set name="addresses"><key column="personId" not-null="true"/><one-to-many class="Address"/></set> </class><class name="Address"><id name="id" column="addressId"><generator class="native"/></id> </class>
create table Person ( personId bigint not null primary key ) create table Address ( addressId bigint not null primary key, personId bigint not null )
http://lavasoft.blog.51cto.com/62575/39317