0
我運行一個HQL,與右連接:休眠 - 選擇從連接表的特定列
select sum(banks.money) from banks right join banks.account where banks.account = :account and (banks.date < :date or banks.date is null) group by banks.account, banks.date
休眠其轉換爲類似的東西:我想Hibernate來
select sum(banks.money) from banks right join accounts on banks.account_id = accounts.account_id where banks.account_id = someId and (banks.date < someDate or banks.date is null) ....
從賬戶表(我可以擁有一個不在銀行表中的賬戶)中的account_id字段,而不是從銀行表中獲取。
有什麼辦法明確告訴hibernate連接表執行哪一列?在這兩種情況下
select sum(banks.money)
from banks
right join banks.account acct
with acct.id = :accountId
where banks.date < :date
or banks.date is null
group by banks.account, banks.date
,特別注意給予別名:
完美工作 非常感謝 – yaarix