6
我想寫以下查詢Hibernate的條件查詢:Hibernate Criteria查詢中的合併等價物?
select
to_char(nvl(ol.updated_datetime, ol.created_datetime), 'dd/mm/yyyy'), sum(discount_price)
from order_line ol
where nvl(ol.updated_datetime, ol.created_datetime) between to_date('05-may-10') and to_date('30-may-10')
group by to_char(nvl(ol.updated_datetime, ol.created_datetime), 'dd/mm/yyyy')
但我不知道如何將NVL函數轉換爲標準的查詢等效。我意識到HQL有一個coalesce表達式,但我想把它寫成一個Criteria查詢。
任何意見將非常感激!
編輯:如果任何人都可以提供一個HQL查詢,做到以上這可能是我的解決方案。