2011-07-15 151 views
0

我有兩個表:地圖集合

Table_A (Id1 PK, Id2) 

Table_B (Id1 PK, Id2 PK, Id3 PK) 

目標:

地圖NHibernate組行從table_b作爲一個集合中table_a對象

<set name="Table_B_elements" table="Table_B" lazy="true"> 
       <key columns="Id1"/> 
       <one-to-many class="Handler"/> 
</set> 

我可以很容易進行查詢,如

select * 
from Table_A as a 
join Table_B as b on b.Id1 = a.Id2; 

任何建議如何映射它?

回答