Map a collection
I have two tables:
Table_A (Id1 PK, Id2)
Table_B (Id1 PK, Id2 PK, Id3 PK)
Goal:
Map to NHibernate
set of rows from table_b
as a collection in table_a
object
<set name="Table_B_elements" table="Table_B" lazy="true">
<key columns="Id1"/>
<one开发者_如何学C-to-many class="Handler"/>
</set>
I can easily make a query like
select *
from Table_A as a
join Table_B as b on b.Id1 = a.Id2;
Any suggestions how to map it?
Yeah. Read http://nhibernate.info/doc/nh/en/index.html#mapping-declaration-join or here http://nhibernate.info/doc/nh/en/index.html#collections-mapping depending on what you really want to select. These are absolute basics for nHibernate. I would suggest first reading docs, then asking.
精彩评论