NHibernate 映射类,带有 pk 和 fk
我有两个表DATA_PERSONELL
,其主键为PERSONNEL_ID
,以及SYS_USER_INFO
,其主键为PERSONELL_ID
这也是 DATA_PERSONELL
表的外键。
当尝试映射 SYS_USER_INFO
时,我尝试过的唯一有效的映射是将 SYS_USER_INFO.PERSONELL_ID
映射为整数,这最终不提供对DATA_PERSONELL
中的数据。
有谁知道如何以正确的方式做到这一点?
I have two tables DATA_PERSONELL
which has a primary key of PERSONNEL_ID
, and SYS_USER_INFO
which has a primary key of PERSONELL_ID
which is also a foreign key to the DATA_PERSONELL
table.
When attempting to map SYS_USER_INFO
, the only mapping that I've tried which has worked is to map SYS_USER_INFO.PERSONELL_ID
as an integer, which ultimately doesn't provide access to the data in DATA_PERSONELL
.
Does anyone know how to do this the right way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用一对一映射。
更多详细信息请参见:
Use a one-to-one mapping.
More details here :