I have this problem too, and unfortunately I think it is by design. The NHibernate 3.0 Linq provider uses HQL under covers, and HQL does not honor your mappings in this regard. For example, if you did
session.CreateQuery ("from profile"). List ()
You would only get a list of all profiles, and your custom class would not join, even if your mapping has external-join = true.
If you used the old NHibernate.Linq provider that used the Critera API or the criteria API directly:
session.CreateCriteria (). List()
You will get a list of all profiles that remain external, connected to users, just like your mapping file.
Now I donβt know why the linq provider supported by HQL does not comply with your mappings (and if anyone knows about this, write), but I believe that is why you see this behavior.
Scott Kirkland
source share