probably it was fixed in 2.1.x branch
2009/9/21 schlachtzeuger <[email protected]>
>
> i have a filter defined on a on-to-many set.
>
> after enabling it:
>
> session.EnableFilter("test").SetParameter("isActive", false);
>
> this hql:.
>
> session.CreateQuery("select o from Order as o left outer join fetch
> o.Lines where o.Id = :orderId")
> .SetGuid("orderId", orderId)
> .UniqueResult<Order>();
>
> gives me this sql (shortened for readability):
>
> select *
> from Order
> left outer join Lines
> on Order.Id = Lines.FkOrdersId
> and 0 = Lines.IsActive
> where Order.Id = '1dcdb688-c30f-4fcc-8bb0-9c8b00239d54'
>
> but if a use this criteria:
>
> session.CreateCriteria<Order>()
> .SetFetchMode("Lines", FetchMode.Eager)
> .Add(Restrictions.Eq("Id", orderId))
> .UniqueResult<Order>();
>
> i get this sql (shortened for readability):
>
> select *
> from Order
> left outer join Lines
> on Order.Id = Lines.FkOrdersId
> and 0 = Lines.IsActive
> where Order.Id = '1dcdb688-c30f-4fcc-8bb0-9c8b00239d54'
> and 0 = Lines.IsActive
>
>
> !! note that the filter restriction is also applyed to the where
> clause when using criteria api
>
> My question:
>
> How do i have to use the criteria api to get the same sql as with
> hql, which means that the filter restriction is only applied to the
> join and not to the where clause?
>
> Thank you
>
> >
>
--
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
-~----------~----~----~----~------~----~------~--~---