Note that there are some explanatory texts on larger screens.

plurals
  1. POnhibernate weird DuplicateMappingException
    text
    copied!<p>I have two classes:</p> <pre><code>namespace fm.web { public class User { public static string default_username = "guest"; public static string default_password = "guest"; private UserType usertype; public virtual int? Id { get; set; } public virtual string Username { get; set; } public virtual string Password { get; set; } public virtual DateTime Datecreated { get; set; } public virtual string Firstname { get; set; } public virtual string Lastname { get; set; } public virtual string Email { get; set; } public virtual UserType Usertype { get { return usertype; } set { usertype = value; } } } } namespace fm.web { public class UserType { public virtual int? Id { get; set; } public virtual string Title { get; set; } } } </code></pre> <p>Here are the mapping files</p> <pre><code>&lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="fm.web" assembly="fm.web"&gt; &lt;class name="User" table="[user]"&gt; &lt;id name="Id"&gt; &lt;column name="id" /&gt; &lt;generator class="native" /&gt; &lt;/id&gt; &lt;property name="Username" /&gt; &lt;property name="Password" /&gt; &lt;property name="Datecreated" /&gt; &lt;many-to-one name="Usertype" class="UserType" column="[type]" cascade="all" lazy="false" /&gt; &lt;property name="Firstname" /&gt; &lt;property name="Lastname" /&gt; &lt;property name="Email" /&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="fm.web" assembly="fm.web"&gt; &lt;class name="UserType" table="[user_type]"&gt; &lt;id name="Id"&gt; &lt;column name="id" /&gt; &lt;generator class="native" /&gt; &lt;/id&gt; &lt;property name="Title" /&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; </code></pre> <p>I'm getting an exception: DuplicateMappingException</p> <p>Could not compile the mapping document: fm.web.data.User.hbm.xml</p> <p>Duplicate class/entity mapping User</p> <p>Is nhibernate always this hard? Maybe I need a different framework.</p>
 

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