开发者

One - to -one mapping using non primary key

开发者 https://www.devze.com 2023-04-12 01:42 出处:网络
I have two tables: Table1 : { id:primary key name: email: } Table2: Lid: primary key tname: email: } In both the cases email is neither primary key, nor the foreign. Is it possible to establish one

I have two tables:

Table1 : { id:primary key name: email: }

Table2: Lid: primary key tname: email: }

In both the cases email is neither primary key, nor the foreign. Is it possible to establish one-to-开发者_Go百科one mapping between both of these tables for the column email. I am using xml for mapping.


<many-to-one class="Table2Entity" name="Table2Entity" property-ref="Email">
  <column name="Email" />
</many-to-one>

however you get errors if you also map email as property an table1 because column email would be mapped twice

0

精彩评论

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