Search in sources :

Example 1 with PageTemplateImpl

use of org.broadleafcommerce.cms.page.domain.PageTemplateImpl in project BroadleafCommerce by BroadleafCommerce.

the class PageDaoImpl method readAllPageTemplates.

@Override
public List<PageTemplate> readAllPageTemplates() {
    CriteriaBuilder builder = em.getCriteriaBuilder();
    CriteriaQuery<PageTemplate> criteria = builder.createQuery(PageTemplate.class);
    Root<PageTemplateImpl> template = criteria.from(PageTemplateImpl.class);
    criteria.select(template);
    try {
        Query query = em.createQuery(criteria);
        query.setHint(QueryHints.HINT_CACHEABLE, true);
        return query.getResultList();
    } catch (NoResultException e) {
        return Collections.emptyList();
    }
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) TypedQuery(javax.persistence.TypedQuery) CriteriaQuery(javax.persistence.criteria.CriteriaQuery) Query(javax.persistence.Query) PageTemplate(org.broadleafcommerce.cms.page.domain.PageTemplate) PageTemplateImpl(org.broadleafcommerce.cms.page.domain.PageTemplateImpl) NoResultException(javax.persistence.NoResultException)

Aggregations

NoResultException (javax.persistence.NoResultException)1 Query (javax.persistence.Query)1 TypedQuery (javax.persistence.TypedQuery)1 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 CriteriaQuery (javax.persistence.criteria.CriteriaQuery)1 PageTemplate (org.broadleafcommerce.cms.page.domain.PageTemplate)1 PageTemplateImpl (org.broadleafcommerce.cms.page.domain.PageTemplateImpl)1