JPA CriteriaBuilder - 过滤其中integer_field =内部查询的计数

时间:2016-08-05 19:47:49

标签: java hibernate jpa

JPA CriteriaBuilder在构建如下所示的复杂查询时很难理解,我该如何解决这个问题?

SELECT * FROM offers o1
WHERE o1.offer_id NOT IN 
(
    SELECT offer_id 
    FROM offers o2
    WHERE o2.max_links_per_cardholder = 
    (
        SELECT COUNT(*)
        FROM linked_offers lo
        WHERE lo.card_id IN 
        (
            SELECT pc.card_id 
            FROM payment_cards pc 
            WHERE pc.cardholder_id = 'BWCI4TRMBRAWAAFL6LGHXR8WAYV6HA'
        )
    )
);

有没有人有关于如何使用JPA CriteriaQuery和CriteriaBuilder以及Root<>来推导谓词的提示?

0 个答案:

没有答案