That sounds like a bug, indeed!

/G

2011/10/3 Matt Mangold <[email protected]>

> I tried using the workaround Defining the filter as
> "tenantId=:tenantId or tenantId is null"
>
> This works, but now I am running into another problem.  I have one
> area of the system where I am batching two queries  Each query is
> doing some eager fetching and then using the distinct root entity
> transformer.  NHibernate throws an error, because the engine is not
> passing enough parameters to the sql statement.  At runtime, the 2
> batched statements have a total of 14 sql parameters, but nHibernate
> only passes 9 parameter values.  This is very strange behavior.  I
> removed all the filters from the mapping files and re ran the queries
> and they run perfectly.  I think that there are possibly more bugs
> related to filters.
>
> On Oct 1, 1:02 am, Ricardo Peres <[email protected]> wrote:
> > There are two open JIRA issues for this problem (also for the where
> > attribute):
> https://nhibernate.jira.com/browse/NH-2877andhttps://nhibernate.jira.com/browse/NH-1930
> .
> > The other workaround is to use fetch mode select or subselect.
> >
> > RP
> >
> > On Sep 30, 3:00 pm, Matt Mangold <[email protected]> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > I agree that a workaround should not be needed.  I think that the
> > > criteria for the filter in the outer joined entity should be put in
> > > the from clause instead of the where clause.
> >
> > > On Sep 29, 5:54 pm, Gunnar Liljas <[email protected]> wrote:
> >
> > > > Defining the filter as "tenantId=:tenantId or tenantId is null" is a
> > > > workaround. Any "join checking" queries will use the primary key of
> the
> > > > joined table anyway, so there should be no side effects.
> >
> > > > I suggest a JIRA search/submission anyway, since such a workaround
> should
> > > > not be needed.
> >
> > > > /G
> >
> > > > 2011/9/29 Matt Mangold <[email protected]>
> >
> > > > > In my application, I have defined a global filter on Tenant Id.  I
> do
> > > > > this to enforce tenant security, so that developers do not
> > > > > accidentally create queries that allow information to cross tenant
> > > > > boundaries.
> >
> > > > > The problem I am having is that when I create queries that eagerly
> > > > > fetch associations, the queries produce sql that uses left outer
> > > > > joins, and the tenant filter is being applied to the entities in
> the
> > > > > left outer join in the where clause.  This essentially acts like an
> > > > > inner join, and I end up losing records.
> >
> > > > > Has anyone experienced this same problem with NHibernate filters.
>  Is
> > > > > there a way to work around this so that I can still enforce this
> type
> > > > > of security and still keep my outer joins in tact?
> >
> > > > > Just to clarify, this is an example of a filter:
> > > > >http://ayende.com/blog/3993/nhibernate-filters
> >
> > > > > Your help is greatly appreciated.
> >
> > > > > --
> > > > > 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.
>
>

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