code: private <T, Y> TypedQuery<T> createTypedQuery(Class<T> entityCls,
              SingularAttribute<T, Y> attribute, Y value) {
          EntityManager entityManager = this.entityManagerProvider.get();
          CriteriaBuilder builder = entityManager.getCriteriaBuilder();
          CriteriaQuery<T> criteriaQuery = builder.createQuery(entityCls);
          Root<T> root = criteriaQuery.from(entityCls);
          Path<Y> path = root.get(attribute);
          return entityManager.createQuery(criteriaQuery.where(
                  builder.equal(path, value)));
      }
docs: Creates a typed query for entities that have the given attribute value.
  
  @param <T> the type of the entity class.
  @param <Y> the type of the target attribute and target value.
  @param attribute the attribute to compare.
  @param value the target value for the given attribute.
  @return a typed query that contains the given criteria.