Question

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.

Taken from the example from hibernate manual:

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. 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?

I'm running NHibernate 2.0.0.

Was it helpful?

Solution

Unfortunately, this is not supported in NHibernate. It was first requested in 2005 and is by far the most popular requested feature.

OTHER TIPS

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

I've received an update report from the NHibernate JIRA yesterday, and this issue should be fixed in NHibernate v2.1.0 Alpha 3 :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top