title: How to return only one record from database using Nhibernate + Criteria + Firebird?
body: <p>I'm using Nhibernate 3.2, Firebird Net Provider 2.7 and Criteria. after googled to how return only one record in database i came to this...</p>
  
  <pre><code>var criteria = session.CreateCriteria(typeof(T))
      .SetFirstResult(0)
      .SetMaxResults(1)
      .Add(getRestricao(rest))
      .UniqueResult&lt;T&gt;();
  
  tx.Commit();
  
  return criteria;
  </code></pre>
  
  <p>But not works! The erros is:</p>
  
  <pre><code>NHibernate.Exceptions.GenericADOException : could not execute query
  [ /* criteria query */ SELECT this_.idPermissao as idPermis1_21_0_, this_.nomePermissao as nomePerm2_21_0_, this_.permissao as permissao21_0_ FROM Permissao this_ WHERE this_.nomePermissao = ? ]
  Name:cp0 - Value:Administrador
  [SQL: /* criteria query */ SELECT this_.idPermissao as idPermis1_21_0_, this_.nomePermissao as nomePerm2_21_0_, this_.permissao as permissao21_0_ FROM Permissao this_ WHERE this_.nomePermissao = ?]
  ----&gt; System.ArgumentException : index should be greater than or equal to 0
  Parameter name: index
  </code></pre>
  
  <p>How to generate the "SELECT FIRST 1" from Firebird in Criteria? Thanks!</p>