HQL用于任何关联

时间:2013-02-26 09:48:51

标签: hibernate nhibernate hql

我正在尝试为具有多对多关联Rental的{​​{1}}编写HQL。

PaymentTypes

from rental where not exists( from PaymentTypes pt where pt.Owner = :rental and type = 'Visa' ) OwnerOwnerIdrental.Id

的任何关联

很遗憾,我无法使用OwnerType = 'Rental'作为预取租金,然后拨打SetEntity费用非常高。

1 个答案:

答案 0 :(得分:0)

为什么不尝试像

这样的动态查询
from rental where not exists(from PaymentTypes pt where pt.Owner.id = " + rental.id + " and type = 'Visa')