Nhibernate - How can I Map junction table in XML
I have 2 tables having many to many relation and hence there is junction table to resolve this like... Table1, Table2 and Junction table na开发者_如何学编程me Table1Table2 having Foreign key of Table1 and Table2 and both are composit key here is what I am doing and getting exception
<class name="Table1Table2" table="Table1Table2" lazy="true">
<many-to-one name="Table1" column="Id" class="Table1"/>
<many-to-one name="Table2" column="Id" class="Table2"/>
is the above schema right?
Thanks
Why don't you just use many-to-many?
http://codebetter.com/blogs/peter.van.ooijen/archive/2008/05/29/nhibernate-many-to-many-collections-or-mapping-is-not-one-table-one-class.aspx
This SO Question may also help you out: Fluent NHibernate Many-to-Many
精彩评论