2011-11-19 117 views
1

我有AddressOrganization表。 Address有FK名为organizationID休眠一对一映射文件

Address类具有以下属性:

Organization organization; 

Organization类具有以下属性:

Address address property; 

的映射Address

<one-to-one name="organization" class="entity3.Organization" 
      constrained="true"> 
</one-to-one> 

如何指定FK列organizationID?如果我把

<column name="OrganizationID" not-null="true"/> 

一对一标签之间我得到XML解析错误。

回答

2

尝试使用property-ref财产,像这样: -

<one-to-one name="organization" class="entity3.Organization" property-ref="OrganizationID" constrained="true"/> 
+0

感谢您的回答!我是否将相同的东西放在组织映射文件中? – bunnyjesse112

+1

如果你想使它成为双向的,你通常把'<多对一名称=“...”class =“...”column =“....”unique =“true”/>'in组织映射文件。 – limc

+0

和我不把任何东西在地址映射?请跟我联系 – bunnyjesse112