Search in sources :

Example 1 with MCRCategoryLink

use of org.mycore.datamodel.classifications2.MCRCategoryLink in project mycore by MyCoRe-Org.

the class MCRCategLinkServiceImpl method getLinks.

@Override
public Collection<MCRCategoryLink> getLinks(String type) {
    EntityManager em = MCREntityManagerProvider.getCurrentEntityManager();
    CriteriaBuilder cb = em.getCriteriaBuilder();
    CriteriaQuery<MCRCategoryLink> query = cb.createQuery(MCRCategoryLink.class);
    Root<MCRCategoryLinkImpl> li = query.from(LINK_CLASS);
    return em.createQuery(query.where(cb.equal(li.get(MCRCategoryLinkImpl_.objectReference).get(MCRCategLinkReference_.type), type))).setHint(QueryHints.READ_ONLY, "true").getResultList();
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) EntityManager(javax.persistence.EntityManager) MCRCategoryLink(org.mycore.datamodel.classifications2.MCRCategoryLink)

Aggregations

EntityManager (javax.persistence.EntityManager)1 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 MCRCategoryLink (org.mycore.datamodel.classifications2.MCRCategoryLink)1