title: fetch single property in object from database
body: <p>I am working on NET MVC 3.0 and Nhibernate 3.0. I want to fetch only one property from database to an object.</p>
  
  <p>For instance, suppose I have a class Module. I want to select all the names from module table (like <code>select modulename from module</code> query) and an prepare a list of module objects which have only name. All other properties can be <code>null</code>.</p>
  
  <p>I tried this using QueryOver API:</p>
  
  <pre><code>IQueryOver&lt;ProjectModule&gt; module = session.QueryOver&lt;ProjectModule&gt;()
      .Select(a=&gt;a.Name)                   
      .TransformUsing(
          NHibernate.Transform.Transformers.AliasToBean&lt;ProjectModule&gt;());
  
  pm = module.List&lt;ProjectModule&gt;();
  </code></pre>
  
  <p><code>pm</code> is <code>IList&lt;ProjectModule&gt;</code> type.</p>
  
  <p>Transaction gets committed successfully. No error occurred, but I get a list of module objects with all properties = <code>null</code>. Module name <code>null</code>, module id <code>null</code> etc.</p>
  
  <p>I checked what query is executing on SQL using NUnit and got this: <code>SELECT this_Name as y0_ FROM ProjectModule this_</code>.</p>