代码之家  ›  专栏  ›  技术社区  ›  nanda

将JQL转换为CriteriaBuilder

  •  2
  • nanda  · 技术社区  · 15 年前

    有人能帮我转换这个JQL吗

    从何处选择资产?1英寸(从a.c类中选择c)

    有人能帮我吗?

    1 回复  |  直到 15 年前
        1
  •  4
  •   James    15 年前

    尝试以下操作:

            CriteriaBuilder qb = em.getCriteriaBuilder();
            CriteriaQuery<Asset> cq = qb.createQuery(Asset.class);
            Root<Asset> asset = cq.from(Asset.class);
            cq.where(qb.parameter(Category.class, "category").in(asset.<Collection<?>>get("categories"))));
            Query query = em.createQuery(cq);
    
    推荐文章