我有桌子:
我现在要用NHibernate和QueryOver进行以下选择:
Select tableAnnual.AnnualAmount, tableAnnual.AnnualCurrency,
tableMonthly.MonthlyAmount, MonthlyAmount.MonthlyCurrency,
tableSharevalue.CurrentSharevalue, tableMiscDetails.clientType, tableMiscDetails.clientName, tableMiscDetails.MarketValueAmount
from tableAnnual
outer join tableMonthly on tableAnnual.creationDate = tableMonthly.creationDate
outer join tableSharevalue on tableMonthly.creationDate = tableSharevalue.creationDate
outer join tableMiscDetails on tableSharevalue.creationDate = tableMiscDetails.creationDate
Where id = 123456
有人可以给我一个样品,我该怎么做? - 我的问题是,我必须加入上面提到的多个表
答案 0 :(得分:0)
在这种情况下使用NHibernate的解决方案是使用HQL
14.2. The from clause (small cite and snippet)
可能会出现多个班级,导致笛卡尔积或“交叉”加入。
from Formula, Parameter
from Formula as form, Parameter as param
或者创建原始SQL。有一些例子如何: