Search in sources :

Example 1 with StructuredContentImpl

use of org.broadleafcommerce.cms.structure.domain.StructuredContentImpl in project BroadleafCommerce by BroadleafCommerce.

the class StructuredContentDaoImpl method findAllContentItems.

@Override
public List<StructuredContent> findAllContentItems() {
    CriteriaBuilder builder = em.getCriteriaBuilder();
    CriteriaQuery<StructuredContent> criteria = builder.createQuery(StructuredContent.class);
    Root<StructuredContentImpl> sc = criteria.from(StructuredContentImpl.class);
    criteria.select(sc);
    try {
        TypedQuery<StructuredContent> query = em.createQuery(criteria);
        query.setHint(QueryHints.HINT_CACHEABLE, true);
        return query.getResultList();
    } catch (NoResultException e) {
        return new ArrayList<StructuredContent>();
    }
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) NoResultException(javax.persistence.NoResultException) StructuredContentImpl(org.broadleafcommerce.cms.structure.domain.StructuredContentImpl) StructuredContent(org.broadleafcommerce.cms.structure.domain.StructuredContent)

Aggregations

NoResultException (javax.persistence.NoResultException)1 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 StructuredContent (org.broadleafcommerce.cms.structure.domain.StructuredContent)1 StructuredContentImpl (org.broadleafcommerce.cms.structure.domain.StructuredContentImpl)1