title: Spring Data JPA, how to get the last Page through Pageable
body: <p>I wanted to fetch the last 5 records of an entity. But unable to fetch it via Spring Data JPA.</p>
  
  <p>Initially I was trying to get the data via LIMIT query but LIMIT isn't supported in JPA.</p>
  
  <p>Later I tried with <code>Pageable</code> interface.</p>
  
  <pre><code>Pageable pageCount = new PageRequest(0, 10, Direction.ASC,"id");
  List&lt;TxnEntity&gt; txnEntities = txnDAO
              .findByAccountEntity(accountEntity,pageCount);
  </code></pre>
  
  <p>This gives me first page with 10 Objects.</p>
  
  <p>But my requirement is to get last 10 or 5 Objects. So how can I get it via <code>Pageable</code> interface in the Spring framework?</p>