@Override
    public long count(final String uid) {
        val count = (Number) entityManager.createQuery(
            "SELECT COUNT(r.userId) FROM " + JpaGoogleAuthenticatorToken.class.getSimpleName() + " r WHERE r.userId= :userId")
            .setParameter("userId", uid.trim().toLowerCase(Locale.ENGLISH))
            .getSingleResult();
        LOGGER.debug("Counted [{}] token record(s) for [{}]", count, uid);
        return count.longValue();
    }
This is {@link GoogleAuthenticatorJpaTokenRepository}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-gauth-jpa/src/main/java/org/apereo/cas/gauth/token/GoogleAuthenticatorJpaTokenRepository.java