title: How to return a single result object from hibernate query?
body: <p>Does a query execution always have to return a list ? How do I replace the code below if I am sure it will only return a single object ?</p>
  
  <pre><code>@Override
      public List&lt;DocInfo&gt; findAllByDocId(String docId)
      {
          Query q = getCurrentSession().createQuery("from DocInfo item where item.id = :docId");
          q.setString("docId", docId);
          List&lt;DocInfo&gt; docInfoList = q.list();
          return docInfoList;
      }
  </code></pre>