title: Execute Stored Procedure NHibernate and return DTO/entity mapped without unique key
body: <p>I have a class and a simple stored procedure like in the following code. The problem is I want to use NHibernate to execute the stored procedure and return a DTO / entity (mapped without unique key). Does anybody have idea? Please help me. Thank you</p>
  
  <pre><code>public class Dto
  {
      public virtual int DeptId { get; set; } 
      public virtual int EmpId { get; set; }  
      public virtual String Name { get; set; }
  }
  
  // mapping without id =&gt; because the stored procedure returns 
  // results that do not have unique column 
  public class DtoMap : ClassMapping&lt;Dto&gt;
  {
      public DtoMap()
      {
          Property(x =&gt; x.EmpId, m =&gt; m.Column("emp_id"));  // if emp_id is PK and I use Id here,  it is ok. But in my case it is impossible
          Property(x =&gt; x.DeptId);
          Property(x =&gt; x.Name, m =&gt; m.Column("name"));
     }
  }
  </code></pre>
  
  <p>Simple code is used to query using NHibernate with correct configuration</p>
  
  <pre><code>var list = session.GetNamedQuery("GetAll").List&lt;Dto&gt;();
  </code></pre>
  
  <p>Stored procedure</p>
  
  <pre><code>CREATE PROC [dbo].[GetAll]
  AS 
     SELECT  
         employeeid as emp_id, deptid, name 
     FROM 
         Employee; -- the query can not change
  </code></pre>