code: protected int selectRecordId(String hash) throws SQLException {
          int id = -1;
          Connection connection = getConnection();
          try {
              PreparedStatement ps = setObjects(connection, Query.GET_RECORD_ID,
                      hash);
              ResultSet rs = ps.executeQuery();
              try {
                  while (rs.next()) {
                      id = rs.getInt("id");
                      break;
                  }
              } finally {
                  rs.close();
                  ps.close();
              }
          } finally {
              connection.close();
          }
          return id;
      }
docs: Given a hash get the first occurance's record id.
  
  @param hash
  @return
  @throws SQLException