use of org.broadleafcommerce.core.catalog.domain.ProductOptionValueImpl in project BroadleafCommerce by BroadleafCommerce.
the class ProductOptionDaoImpl method countAllowedValuesForProductOptionById.
@Override
public Long countAllowedValuesForProductOptionById(Long productOptionId) {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<Long> criteria = builder.createQuery(Long.class);
Root<ProductOptionValueImpl> root = criteria.from(ProductOptionValueImpl.class);
criteria.select(builder.count(root));
List<Predicate> restrictions = new ArrayList<>();
List<Long> mergedIds = sandBoxHelper.mergeCloneIds(ProductOptionImpl.class, productOptionId);
restrictions.add(root.get("productOption").in(mergedIds));
criteria.where(restrictions.toArray(new Predicate[restrictions.size()]));
TypedQuery<Long> query = em.createQuery(criteria);
return query.getSingleResult();
}
Aggregations