Hey there,
Bellow are my comments on your problem:
1. My opinion is that there is now way you can apply fetch join to an association that you also intend to filter, in your case:
.SetFetchMode("ContactDetails", FetchMode.Join)
and
.CreateCriteria("ContactDetails", "CD")
.Add(new NullExpression("ContactDetailName"))
(although I maybe mistaken on this one, but I found this by trial and error)
2. With criteria there is now way you can generate left join's
3. You can do it either via HQL or qith a custom SQL expression in criteria:
session.CreateCriteria(typeof(Contact))
.SetFetchMode("ContactDetails", FetchMode.Join)
.Add( Expression.Sql("(select count(details.id) from details where details.contactid = {alias}.contactid) = 0 ") )
_________________ Dragos
|