Francois,
That is possible with Criteria since NH3.0.
The feature in HQL
http://fabiomaulo.blogspot.com/2009/05/nhibernate-210-hql-with-clause.html

<http://fabiomaulo.blogspot.com/2009/05/nhibernate-210-hql-with-clause.html>With
Criteria have a look to
CreateAlias(string associationPath, string alias, JoinType joinType,
ICriterion withClause)
CreateCriteria(string associationPath, string alias, JoinType joinType,
ICriterion withClause)

With QueryOver it is not available but, is you add a new JIRA ticket,
perhaps we can release it with NH3.2

On Tue, Mar 22, 2011 at 12:01 PM, Francois Ward <[email protected]>wrote:

> Someone correct me if I'm wrong, but thats generally not possible with
> Criteria or QueryOver, unless you use predefined Filters in the mapping and
> activate the filter before the query, so HQL or LINQ tends to handle these
> cases a bit more smoothly.
>
> -Francois
>
>
> On Tue, Mar 22, 2011 at 4:52 AM, Michael Watkin <[email protected]>wrote:
>
>> Hello,
>>
>> I have a query using that specifies the with clause criteria on a left
>> outer join. I can do that with the ICriteria API like so:
>>
>> return Session.CreateCriteria<A>()
>>    .Add(Restrictions.Eq("Name", name))
>>    .Add(Restrictions.IsNull("EffectiveToDate"))
>>    .CreateCriteria("FamilyMembers", "pfm", JoinType.LeftOuterJoin,
>> Restrictions.IsNull("pfm.EffectiveToDate"))
>>    .UniqueResult<A>();
>>
>> However, I can't seem to find a way to do it with QueryOver(). Is
>> there any support in the QueryOver API for specifying the with clause
>> on a left outer join? Or is there a better way to write the query? I'm
>> using NHibernate 3.0.
>>
>> Thanks,
>> Michael.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "nhusers" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>



-- 
Fabio Maulo

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to