code: private long count(final StringBuilder sql, final List<Object> paramList) throws RepositoryException {
          final Connection connection = getConnection();
  
          JSONObject jsonObject;
          long count;
  
          try {
              jsonObject = JdbcUtil.queryJsonObject(sql.toString(), paramList, connection, getName(), debug);
              count = jsonObject.getLong(jsonObject.keys().next());
          } catch (final Exception e) {
              LOGGER.log(Level.ERROR, "Count failed", e);
  
              throw new RepositoryException(e);
          }
  
          return count;
      }
docs: Count.
  
  @param sql       sql
  @param paramList paramList
  @return count
  @throws RepositoryException RepositoryException