Re: [nhusers] Re: Oracle Dialect not working properly with Linq Single function

2010-07-06 Thread Fabio Maulo
Steve, the exception was about missed parameters values (pagination parameters missed). I'll re-install oracle and check it. -- Fabio Maulo El 06/07/2010, a las 05:29, Steve Strong escribió: I think there are actually two separate issues here. Single() & SingleOrDefault() work correctly if th

Re: [nhusers] Re: Oracle Dialect not working properly with Linq Single function

2010-07-06 Thread Steve Strong
I think there are actually two separate issues here. Single() & SingleOrDefault() work correctly if there are zero or one results; they are incorrect if there is more than one result (due to a buggy use of SetMaxResults(1), which I'll fix). But that's not the bug that's being seen here. What And

Re: [nhusers] Re: Oracle Dialect not working properly with Linq Single function

2010-07-05 Thread Fabio Maulo
Sir Steve Strong knows it, don't worry. On Mon, Jul 5, 2010 at 3:39 PM, Diego Mijelshon wrote: > It's not necessarily a bug in the code. > An exception is just that: a state that deviates from the rule. > While the code shouldn't be designed around exceptions, it can happen that, > given a spec o

Re: [nhusers] Re: Oracle Dialect not working properly with Linq Single function

2010-07-05 Thread Diego Mijelshon
It's not necessarily a bug in the code. An exception is just that: a state that deviates from the rule. While the code shouldn't be designed around exceptions, it can happen that, given a spec of "there can be one and only one X where Y=Z" you try to retrieve it using Single and, somehow (say, beca

Re: [nhusers] Re: Oracle Dialect not working properly with Linq Single function

2010-07-05 Thread Fabio Maulo
If you write a query that may return 10 records and there you put "Single" you are foo or you have a bug. That is what "Single" mean and for that reason it throw exception when more than one instance are selected. In NH we don't have to change its meaning putting an unnecessary pagination (SetMaxR

Re: [nhusers] Re: Oracle Dialect not working properly with Linq Single function

2010-07-05 Thread Diego Mijelshon
I can't think of a better way to do it. For Single, this is the behavior: - Request at most 2 records from the server (to avoid doing extra work) - If no records returned, exception - If one record returned, map it and we're done - If more than one record returned, exception For SingleOrDefault i

Re: [nhusers] Re: Oracle Dialect not working properly with Linq Single function

2010-07-05 Thread Fabio Maulo
There is no need to complicate the query for "Single" -- Fabio Maulo El 05/07/2010, a las 12:16, Diego Mijelshon escribió: IIRC, Single/SingleOrDefault use SetMaxResults(2), and then checks that a single record is returned... Diego On Mon, Jul 5, 2010 at 10:19, Fabio Maulo wrote: > For

Re: [nhusers] Re: Oracle Dialect not working properly with Linq Single function

2010-07-05 Thread Fabio Maulo
It happenin provider. You can execute the linq first and then apply Single > var query = (from a in session.Query() > where a.Username == username > select a).ToList(); > var user = query.Single(); -- Fabio Maulo El 05/07/2010, a las 12:

[nhusers] Re: Oracle Dialect not working properly with Linq Single function

2010-07-05 Thread andrew6072
How do I use the SetMaxResults in the case ? Or is that something the happens somewhere in the linq provider ? public OlaUser GetByUsername(string username) { var session = GetSession(); var query = (from a in session.Query() w

Re: [nhusers] Re: Oracle Dialect not working properly with Linq Single function

2010-07-05 Thread Diego Mijelshon
IIRC, Single/SingleOrDefault use SetMaxResults(2), and then checks that a single record is returned... Diego On Mon, Jul 5, 2010 at 10:19, Fabio Maulo wrote: > For "First" and "FirstOrDefault" we can apply SetMaxResults(1) ... and fix > the bug (please check last JIRAs and add a new one if

Re: [nhusers] Re: Oracle Dialect not working properly with Linq Single function

2010-07-05 Thread Fabio Maulo
about the different behavior of each NH's query system well... it is normal... Different systems, different implementations, different results On Mon, Jul 5, 2010 at 10:19 AM, Fabio Maulo wrote: > For "First" and "FirstOrDefault" we can apply SetMaxResults(1) ... and fix > the bug (please ch

Re: [nhusers] Re: Oracle Dialect not working properly with Linq Single function

2010-07-05 Thread Fabio Maulo
For "First" and "FirstOrDefault" we can apply SetMaxResults(1) ... and fix the bug (please check last JIRAs and add a new one if you can't find an existing) For "Single" and "SingleOrDefault" we *shouldn't* apply SetMaxResults(1) because doing so we will change the "Single" behavior (it should thr

[nhusers] Re: Oracle Dialect not working properly with Linq Single function

2010-07-05 Thread andrew6072
Hi Fabio, What do you mean by changing the meaning of Single ? Oh and It also happens with First(), and SingleOrDefault() as well It seems to be something to do with this call bool useLimit = UseLimit(selection, dialect); when I use Query<> it returns true, and if I use QueryOver<> it return fa

Re: [nhusers] Re: Oracle Dialect not working properly with Linq Single function

2010-07-05 Thread Fabio Maulo
Confirmed, we have a bug. We are changing the meaning of Single. On Mon, Jul 5, 2010 at 8:35 AM, Fabio Maulo wrote: > If our provider creates a paginated query for the method "Single" we have a > bug. > > > On Mon, Jul 5, 2010 at 8:06 AM, andrew6072 > wrote: > >> Hi Fabio, >> >> I think the exc

Re: [nhusers] Re: Oracle Dialect not working properly with Linq Single function

2010-07-05 Thread Fabio Maulo
If our provider creates a paginated query for the method "Single" we have a bug. On Mon, Jul 5, 2010 at 8:06 AM, andrew6072 wrote: > Hi Fabio, > > I think the exception got chopped off, this is the full exception. > > [SQL: select * from ( select olauser0_.USER_ID as USER1_57_, > olauser0_.USERNA

[nhusers] Re: Oracle Dialect not working properly with Linq Single function

2010-07-05 Thread andrew6072
Hi Fabio, I think the exception got chopped off, this is the full exception. [SQL: select * from ( select olauser0_.USER_ID as USER1_57_, olauser0_.USERNAME as USERNAME57_, olauser0_.EMAIL_ADDRESS as EMAIL3_57_, olauser0_.COMMENTS as COMMENTS57_, olauser0_.PASSWORD as PASSWORD57_, olauser0_.PASSW