我有以下财产
<property name="Allocated" type="decimal" formula="(select sum(a.AllocationAmount) from Allocation a where a.TransactionId = TransactionId)" />
这会加载已分配给运行良好的发票的交易金额。
但是,大多数情况下我并不关心这个数量。有没有办法有条件地加载这个计算列?或者有没有办法将此计算列添加到 HQL/Critera,以便我可以将其作为我运行的某些特定查询的一部分?