1

我必须在休眠的条件查询中创建这种类型的查询

SELECT *
        FROM
        ${hibernate.default_schema}.VW_GEMS_CUST_TRNG_RPT CUSTOMER,
        (SELECT * FROM ${hibernate.default_schema}.VW_GEMS_VENUE WHERE ORG_NAME =?)
        VENUE
        WHERE
        CUSTOMER.PRIMARY_VENUE_ROW_ID = VENUE.VENUE_ROW_ID(+)
        AND CUSTOMER.ORG_NAME =?
        AND CUSTOMER.CONTACT_ID =?
        ORDER BY CUSTOMER.EVNT_START_DT DESC

我该怎么做呢?

4

1 回答 1

0

ROM 子句中的子选择不能与条件 API 一起使用。
但是您可以在没有子选择的情况下重写查询。

SELECT *
FROM
    ${hibernate.default_schema}.VW_GEMS_CUST_TRNG_RPT CUSTOMER
inner join ${hibernate.default_schema}.VW_GEMS_VENUE VENUE
        on (CUSTOMER.PRIMARY_VENUE_ROW_ID = VENUE.VENUE_ROW_ID(+) 
       and venue.ORG_NAME =?)
WHERE
      CUSTOMER.ORG_NAME =?
      AND CUSTOMER.CONTACT_ID =?
ORDER BY CUSTOMER.EVNT_START_DT DESC
于 2013-02-11T17:01:49.367 回答