title: Select top 1 result using JPA
body: <p>I need to bring from DB only one single result. How can I do that with JPA?</p>
  
  <pre><code>Select top 1 * from table
  </code></pre>
  
  <p>I tried </p>
  
  <blockquote>
    <p>"select t from table t"</p>
  </blockquote>
  
  <pre><code>query.setMaxResults(1);
  
  query.getSingleResult();
  </code></pre>
  
  <p>but didn't work. Any other ideas?</p>