Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Found an article which you may find helpful. <a href="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" rel="nofollow noreferrer">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</a></p> <p>To summarize your solution looks very similar. For completeness here is what the nHibernate mapping file might look like for your User object. Using the nHibernate mapping collection for your lists of Users and Subjects.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="YourAssemblyName" namespace="YourNamespace"&gt; &lt;class name ="User" table="Users" proxy="User"&gt; &lt;id name="Id" type="Int32" column="idUser"&gt; &lt;generator class="identity"&gt;&lt;/generator&gt; &lt;/id&gt; &lt;many-to-one name="CreatedBy" class="User" column="idUser"&gt;&lt;/many-to-one&gt; &lt;bag name="subjects" table="tblUserSubject" lazy="false" &gt; &lt;key column="idUser"&gt;&lt;/key&gt; &lt;many-to-many class="Subject" column="idSubject"&gt;&lt;/many-to-many&gt; &lt;/bag&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; </code></pre> <p>subjects is a bag which uses the table tblUserSubject. The key to this linking table is idUser (assuming that is what your identity column name is). The many to many class is the Subject class we just mapped.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload