Let me explain my fix in more detail. My original problem was,
that my criteria didn’t work because I used a parameterized filter and a
subquery. So I went through the code and found out:
1)
There is a bug in QueryParameters.ProcessFilters,
where filter parameters and (internal) positional parameters (e.g. from a
criteria) get messed up. This one was easy to fix and works for me.
Then I wrote some tests to see if my fix breaks anything else. During
that I found out that:
2)
a subquery with named
parameters and parameterized filters fails because the parameters get also
messed up
3)
mixing named and positional
parameters does not work properly depending on the order of occurrence in the
query
I agree that 3) isn’t good practice, but it shows the
basic problem, because that happens when you combine subqueries and
parameterized filters. I tried to find out where to start fixing that problem,
but I’m not familiar enough with the code yet.
I’ve attached my fix and the test cases to NH-1098. It’s
a fix on the 1.2.1-GA branch, is that OK ? Or do you need one for the trunk ?
Regards,
Wolfgang
From:
nhibernate-development-bounces@lists.sourceforge.net
[mailto:nhibernate-development-bounces@lists.sourceforge.net] On Behalf Of Fabio
Maulo
Sent: Montag, 25. Februar 2008 23:25
To: the NHibernate development list
Subject: Re: [NHibernate-development] NH-1098
2008/2/25, Luis Ferreira <lmcpferreira@gmail.com>:
I only use named parameters. Isn't NHibernate itself that sometimes uses positional? I'm pretty sure of that... that's why I get mixed strategies in my generated SQL. Perhaps it is coming from parametrized filters (just a hunch).
NH use positional and users i better if use named.....
NH prefer to use positional to don't introduce "parameters naming
restrictions" (if NH use a name for a special matter you can't use the
same name).
Because NH use positional, in general, is better if users don't use it.
Bye.
Fabio Maulo.
P.S. NH introduce parameters to your query in many many cases ... not only for
session.Filters...