[英]Doesn't NHibernate HQL support “with” keyword?
I'm trying to build a HQL that can left join values from a collection, in order to give me the chance of checking "is null" on it. 我正在尝试构建一个可以从集合中保留连接值的HQL,以便让我有机会在其上检查“is null”。
Taken from the example from hibernate manual: 摘自hibernate手册中的示例:
from Cat as cat left join cat.kittens as kitten with kitten.bodyWeight > 10.0
doesn't seem to work in NHibernate, since it doesn't recognize the "with" keyword. 似乎在NHibernate中不起作用,因为它无法识别“with”关键字。 How else are you supposed to left join and check for no-matching entries if you cannot specify join-clauses directly in your join as opposed to in your WHERE-statement? 如果你不能直接在你的连接中指定join-clauses而不是你的WHERE语句,你还应该如何离开join并检查不匹配的条目?
I'm running NHibernate 2.0.0. 我正在运行NHibernate 2.0.0。
Unfortunately, this is not supported in NHibernate. 不幸的是,NHibernate不支持这一点。 It was first requested in 2005 and is by far the most popular requested feature. 它于2005年首次被要求,是迄今为止最受欢迎的功能。
I think you can workaround it by using an outer join, and then do this: 我认为您可以通过使用外部联接来解决它,然后执行此操作:
from Cat c
left join c.Kittens as kitten
where kitten.bodyweight > 10 or kitten.bodyweight is null
Apparently they're working on it ... https://nhibernate.jira.com/browse/NH-514 显然他们正在努力... https://nhibernate.jira.com/browse/NH-514
I've received an update report from the NHibernate JIRA yesterday, and this issue should be fixed in NHibernate v2.1.0 Alpha 3 :) 我昨天收到了NHibernate JIRA的更新报告,这个问题应该在NHibernate v2.1.0 Alpha 3中修复:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.