<set name="spPersondepts" lazy="true" cascade="all" fetch="join"
inverse="true"
where="(SELECT t.ISNEEDSYNC FROM CT_SP_PERSONINFO t WHERE t.ID=PERSON)=1">
<key column="DEPT" property-ref="dcode" />
<one-to-many class="SpPersondept" />
</set>
PERSON字段为子表中的。只要不加表别名,hibernate默认该字段为子表的。若要写嵌套查询,对表加别名即可。