@Override
    public OneTimeTokenAccount update(final OneTimeTokenAccount account) {
        val ac = entityManager.find(JpaGoogleAuthenticatorAccount.class, account.getId());
        if (ac != null) {
            ac.setValidationCode(account.getValidationCode());
            ac.setScratchCodes(account.getScratchCodes()
                .stream()
                .map(code -> BigInteger.valueOf(code.longValue()))
                .collect(Collectors.toList()));
            ac.setSecretKey(account.getSecretKey());
            val encoded = encode(ac);
            return entityManager.merge(encoded);
        }
        return null;
    }
This is {@link JpaGoogleAuthenticatorTokenCredentialRepository} that stores gauth data into a RDBMS database.

@author Misagh Moayyed
@since 5.0.0
support/cas-server-support-gauth-jpa/src/main/java/org/apereo/cas/gauth/credential/JpaGoogleAuthenticatorTokenCredentialRepository.java