我已經得到了我不知道流利NHibernate的支持的數據模型 - 想知道是否有人能告訴我它是否確實,如果是的話,該怎麼辦呢。其基本結構是:NHibernate的「的hasMany」沒有明確的FKS
create table Container (
id int identity(1,1) NOT NULL,
root_item_id int
)
create table ItemRelationship (
id int identity(1, 1) NOT NULL,
parent_item_id INT,
child_item_id INT
)
create table Item (
id int identity(1, 1) NOT NULL,
description VARCHAR(20)
)
所以一言以蔽之: 1)集裝箱有根項目 2)的項目,有小孩項目
我想在我的「容器」實體屬性,是它的根項目的孩子的項目的集合。我可以看到如何設置「直接」 FK的關係,但是這個人是有點不尋常,因爲關係鏈是:
Container.root_item_id - > ItemRelationship.parent_item_id
這裏沒有一個明確的FK那裏。我假設我必須以某種方式使用「Where」方法,但我不確定如何 - 無法找到示例。有任何想法嗎?
這給了我我需要的東西!謝謝! – Marty 2009-07-31 17:39:56