title: Detecting missing records on numbered table
body: <p>I have a database which stores messages. There is a "count" column, so first message has count 1, second message count 2 etc.</p>
  
  <p>Now I am looking for a way to detect if a message is missing, example: "select count from message" returns 1,2,4 instead of 1,2,3,4.</p>
  
  <p>I use hibernate on the backend. So a solution in Java is welcome too.</p>
  
  <p>Thanks.</p>