title: SELECT TOP 10 FROM T using CreateQuery/CreateCriteria/QueryOver<T> at Repository Level not at Entity Level
body: <p>I have been facing problem fetching the latest 10 posts made by user.
  I wrote the following Nhibernate query as follows.</p>
  
  <pre><code>    public IList&lt;T&gt; GetLatest10Posts()
      {
          using (var session = sessionFactory.OpenSession())
          using (var transaction = session.BeginTransaction())
          {
              var queryString = String.Format("SELECT TOP 10 FROM {0} ORDER BY DateUpdated DESC", typeof(T));
              var returnVal = session.CreateQuery(queryString).List&lt;T&gt;();
              transaction.Commit();
              return returnVal;
          }
      }
  </code></pre>
  
  <p>Exception Thrown</p>
  
  <blockquote>
    <p>Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. near line 1, column 11</p>
  </blockquote>
  
  <p>Note: DateUpdated is the column name and is of DateTime type, which is present in all the inheriting entities.</p>
  
  <p>Is there any luck with QueryOver api as I am trying to achieve something like this:</p>
  
  <pre><code>session.QueryOver&lt;T&gt;().Take(10).OrderBy().Desc 
  </code></pre>