title: What is the LIMIT clause alternative in JPQL?
body: <p>I'm working with PostgreSQL query implementing in JPQL.</p>
  
  <p>This is a sample native psql query which works fine,</p>
  
  <pre><code>SELECT * FROM students ORDER BY id DESC LIMIT 1;
  </code></pre>
  
  <p>The same query in JPQL doesnt work,</p>
  
  <pre><code>@Query("SELECT s FROM Students s ORDER BY s.id DESC LIMIT 1")
  
  Students getLastStudentDetails();
  </code></pre>
  
  <p>seems like LIMIT clause doesn't work in JPQL.</p>
  
  <p>According to JPA documentation we can use <code>setMaxResults/setFirstResult</code>, Can anyone tell me how can I use that in my above query?</p>