Tag: 子查询查询

NHibernate QueryOver带有子查询和别名

我正在努力将以下(简化)HQL转换为QueryOver: select subscription from Subscription as subscription where not exists ( from Shipment as shipment where shipment.Subscription = subscription and (shipment.DeliveryDate = :deliveryDate) ) 我走到这一步: Subscription subscription = null; Session.QueryOver(() => subscription) .Where(Subqueries.NotExists(QueryOver.Of() .Where(shipment => shipment.Subscription == subscription) .And(shipment=> shipment.DeliveryDate == deliveryDate) .Select(shipment => shipment.Id).DetachedCriteria)); .TransformUsing(new DistinctRootEntityResultTransformer()); 问题是上面的Subqueries和Where语句给了我以下(无效)where子句: where shipment.SubscriptionId is null 当我想要的是: where shipment.SubscriptionId […]