@Override
    public Optional<ResourceSet> getById(final long id) {
        try {
            val query = String.format("SELECT r FROM %s r WHERE r.id = :id", ENTITY_NAME);
            val r = this.entityManager.createQuery(query, JpaResourceSet.class)
                .setParameter("id", id)
                .getSingleResult();
            return Optional.of(r);
        } catch (final NoResultException e) {
            LOGGER.debug(e.getMessage());
        }
        return Optional.empty();
    }
This is {@link JpaResourceSetRepository}.

@author Misagh Moayyed
@since 6.0.0
support/cas-server-support-oauth-uma-jpa/src/main/java/org/apereo/cas/uma/ticket/resource/repository/impl/JpaResourceSetRepository.java