title: How to start selecting results starting from last row in Database table using Criteria Query JPA?
body: <p>The problem is same as: <a href="https://stackoverflow.com/questions/16792785/search-mysql-table-starting-from-last-row">Search mysql table starting from last row</a></p>
  
  <pre><code>╔════╦════════════╦════════════╦═════════════╦════════════╗
  ║ id ║  field_1   ║   field_2  ║   field_n   ║    time    ║
  ╠════╬════════════╬════════════╬═════════════╬════════════╣
  ║  1 ║ data_field ║ data_field ║ data_field  ║ 1369748934 ║
  ║  2 ║ data_field ║ data_field ║ data_field  ║ 1369748935 ║
  ║  3 ║ data_field ║ data_field ║ data_field  ║ 1369748936 ║
  ║  4 ║ data_field ║ data_field ║ data_field  ║ 1369748936 ║
  ║  5 ║ data_field ║ data_field ║ data_field  ║ 1369748938 ║
  ║  6 ║ data_field ║ data_field ║ data_field  ║ 1369748939 ║
  ╚════╩════════════╩════════════╩═════════════╩════════════╝
  </code></pre>
  
  <p>I want to retrieve first 'n' results starting at row index 'i' meeting certain criteria:</p>
  
  <p>Case 1) Search should start from index 'i' and then move downwards</p>
  
  <p>Case 2) Search should start from index 'i' and then move upwards </p>
  
  <p>Case 1) is pretty straight. How can case 2) be achieved ?</p>