Oskar, It seems like the test I have that ran against both databases used 3.2.0.400. My test that used 3.3.1.400 was only against SQL Server which was workign fine anyway. I will retest against Oracle and 3.3.1. Thanks.
On Tuesday, February 12, 2013 2:01:34 AM UTC-6, Oskar Berggren wrote: > Are you absolutely positively _sure_ that you have really tested with > 3.3.1 or later? And did not accidentally reuse 3.2.0? Because I'm > testing you code with 3.3.3-CR1 and it works as intended - returning 1 > row, and it's the expected one. > > This is my Nhibernate configuration for Oracle: > <property > name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property> > > > <property > name="connection.driver_class">NHibernate.Driver.OracleDataClientDriver</property> > > > <property name="dialect">NHibernate.Dialect.Oracle10gDialect</property> > > /Oskar > > > 2013/2/11 wsadiq <[email protected] <javascript:>>: > > Oskar, > > > > Actually 2853 looks very much like the issue I have. I think the only > > difference that I see is that I have a set of Ids that I am doin "In" > in. > > My test code is very simple and I have reproduced the query as well. > > > > > -------------------------------------------------------------------------------------- > > > > ICriteria crit = CurrentSession.CreateCriteria(typeof(T)); > > long[] ids = new long[] { 44,162,165,168,171,174}; > > crit.Add(Expression.In("Id",ids)); > > crit.SetFirstResult(3); > > crit.SetMaxResults(1); > > IList<T> set = crit.List<T>(); > > > -------------------------------------------------------------------------------------- > > > > select Id64_0_, > > Code64_0_, > > Name64_0_, > > Targeted64_0_, > > StartDate64_0_, > > EndDate64_0_, > > DisplayO7_64_0_, > > CreateDate64_0_, > > UpdateDate64_0_ > > from (select row_.*, > > rownum rownum_ > > from (SELECT this_.Id as Id64_0_, > > this_.Code as Code64_0_, > > this_.Name as Name64_0_, > > this_.Targeted as Targeted64_0_, > > this_.StartDate as StartDate64_0_, > > this_.EndDate as EndDate64_0_, > > this_.DisplayOrder as DisplayO7_64_0_, > > this_.CreateDate as CreateDate64_0_, > > this_.UpdateDate as UpdateDate64_0_ > > FROM LW_Promotion this_ > > WHERE this_.Id in (44 /* :p0 */, 162 /* :p1 */, 165 /* > :p2 > > */, 168 /* :p3 */, > > 171 /* :p4 */, 174 /* :p5 */)) row_ > > where rownum <= 1 /* :p6 */) > > where rownum_ > 3 /* :p7 */ > > > > Thanks for your help. > > > > Waqar > > > > On Monday, February 11, 2013 2:17:11 PM UTC-6, Oskar Berggren wrote: > >> > >> See if any of these sounds like matching issues: > >> > >> https://nhibernate.jira.com/browse/NH-2840 > >> https://nhibernate.jira.com/browse/NH-2940 > >> https://nhibernate.jira.com/browse/NH-2853 > >> > >> They are marked as fixed in 3.3.0 though, but perhaps there is some > >> lingering issue. > >> > >> /Oskar > >> > >> > >> 2013/2/11 wsadiq <[email protected]>: > >> > I agree that it would be a good idea to add the ordering but I don't > see > >> > how > >> > that would fix the original problem that I posted. The problem I > have > >> > with > >> > the rownum generated is how nHibernate is translating the same > criteria > >> > between SQL Server and Oracle differently, yielding different results > >> > with > >> > the same data in the database. In Oracle, I am getting less objects > in > >> > the > >> > set than expected. Ordering would have helped if I was getting the > >> > correct > >> > number of rows but not the exptected rows. > >> > > >> > > >> > > >> > On Monday, February 11, 2013 10:16:11 AM UTC-6, Rippo wrote: > >> >> > >> >> I would still add a order by to the query, just because the data is > the > >> >> same doesn’t guarantee that the results will be the same... > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> From: [email protected] [mailto:[email protected]] On > >> >> Behalf > >> >> Of wsadiq > >> >> > >> >> > >> >> Sent: 11 February 2013 14:45 > >> >> To: [email protected] > >> >> > >> >> Subject: Re: [nhusers] Issue with SetFirstResult and SetMaxResults > >> >> > >> >> > >> >> > >> >> I am getting the same result with 3.3.1 as well as 3.2.0. > >> >> > >> >> > >> >> > >> >> Thanks. > >> >> > >> >> > >> >> On Wednesday, February 6, 2013 11:29:04 PM UTC-6, Alexander I. > Zaytsev > >> >> wrote: > >> >> > >> >> What version of NHibernate are you using? Also, you missed ordering > in > >> >> query. To get correct paged results query must be ordered. > >> >> > >> >> > >> >> > >> >> Best Regards, Alex > >> >> > >> >> > >> >> > >> >> 2013/1/30 unhaddins <[email protected]> > >> >> > >> >> I am executing the same criteria against SQLServer and Oracle and > get > >> >> two > >> >> differen tresults. the data in both databases is exactly the same. > >> >> > >> >> > >> >> > >> >> First, here is my code. > >> >> > >> >> > >> >> > >> >> ICriteria crit = CurrentSession.CreateCriteria(typeof(T)); > >> >> > >> >> crit.SetFirstResult(3); > >> >> > >> >> crit.SetMaxResults(1); > >> >> > >> >> IList<T> set = crit.List<T>(); > >> >> > >> >> > >> >> > >> >> I am wanting to get 1 row starting from record 4 (assuming 0 base). > >> >> That > >> >> is exactly the result I get from SQL Server but the query generated > for > >> >> Oracle returns 0. Here are the queries generated by nHibernate > >> >> captured > >> >> through NHProfiler. > >> >> > >> >> SQL SERVER QUERY > >> >> > >> >> SELECT TOP (1 /* @p0 */) Id64_0_, > >> >> Code64_0_, > >> >> Name64_0_, > >> >> Targeted64_0_, > >> >> StartDate64_0_, > >> >> EndDate64_0_, > >> >> DisplayO7_64_0_, > >> >> CreateDate64_0_, > >> >> UpdateDate64_0_ > >> >> FROM (SELECT this_.Id as > >> >> Id64_0_, > >> >> this_.Code as > >> >> Code64_0_, > >> >> this_.Name as > >> >> Name64_0_, > >> >> this_.Targeted as > >> >> Targeted64_0_, > >> >> this_.StartDate as > >> >> StartDate64_0_, > >> >> this_.EndDate as > >> >> EndDate64_0_, > >> >> this_.DisplayOrder as > >> >> DisplayO7_64_0_, > >> >> this_.CreateDate as > >> >> CreateDate64_0_, > >> >> this_.UpdateDate as > >> >> UpdateDate64_0_, > >> >> ROW_NUMBER() OVER(ORDER BY CURRENT_TIMESTAMP) as > >> >> __hibernate_sort_row > >> >> FROM LW_Promotion this_ > >> >> WHERE this_.Id in (2 /* @p1 */, 4 /* @p2 */, 5 /* @p3 */, 6 > /* > >> >> @p4 */, > >> >> 7 /* @p5 */, 8 /* @p6 */)) as query > >> >> WHERE query.__hibernate_sort_row > 3 /* @p7 */ > >> >> ORDER BY query.__hibernate_sort_row > >> >> > >> >> ORACLE QUERY > >> >> > >> >> > >> >> > >> >> select Id64_0_, > >> >> Code64_0_, > >> >> Name64_0_, > >> >> Targeted64_0_, > >> >> StartDate64_0_, > >> >> EndDate64_0_, > >> >> DisplayO7_64_0_, > >> >> CreateDate64_0_, > >> >> UpdateDate64_0_ > >> >> from (select row_.*, > >> >> rownum rownum_ > >> >> from (SELECT this_.Id as Id64_0_, > >> >> this_.Code as Code64_0_, > >> >> this_.Name as Name64_0_, > >> >> this_.Targeted as Targeted64_0_, > >> >> this_.StartDate as StartDate64_0_, > >> >> this_.EndDate as EndDate64_0_, > >> >> this_.DisplayOrder as DisplayO7_64_0_, > >> >> this_.CreateDate as CreateDate64_0_, > >> >> this_.UpdateDate as UpdateDate64_0_ > >> >> FROM LW_Promotion this_ > >> >> WHERE this_.Id in (44 /* :p0 */, 162 /* :p1 */, 165 > /* > >> >> :p2 */, 168 /* :p3 */, > >> >> 171 /* :p4 */, 174 /* :p5 */)) > row_ > >> >> where rownum <= 1 /* :p6 */) > >> >> where rownum_ > 3 /* :p7 */ > >> >> > >> >> > >> >> > >> >> Can anybody shed some light as to what is nHobernate tryign to do > with > >> >> the > >> >> oracle query. > >> >> > >> >> > >> >> > >> >> Thanks in advance. > >> >> > >> >> > >> >> > >> >> Waqar Sadiq > >> >> > >> >> > >> >> > >> >> -- > >> >> You received this message because you are subscribed to the Google > >> >> Groups > >> >> "nhusers" group. > >> >> To unsubscribe from this group and stop receiving emails from it, > send > >> >> an > >> >> email to [email protected]. > >> >> To post to this group, send email to [email protected]. > >> >> Visit this group at http://groups.google.com/group/nhusers?hl=en. > >> >> For more options, visit https://groups.google.com/groups/opt_out. > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> -- > >> >> You received this message because you are subscribed to the Google > >> >> Groups > >> >> "nhusers" group. > >> >> To unsubscribe from this group and stop receiving emails from it, > send > >> >> an > >> >> email to [email protected]. > >> >> To post to this group, send email to [email protected]. > >> >> Visit this group at http://groups.google.com/group/nhusers?hl=en. > >> >> For more options, visit https://groups.google.com/groups/opt_out. > >> >> > >> >> > >> > > >> > -- > >> > You received this message because you are subscribed to the Google > >> > Groups > >> > "nhusers" group. > >> > To unsubscribe from this group and stop receiving emails from it, > send > >> > an > >> > email to [email protected]. > >> > To post to this group, send email to [email protected]. > >> > Visit this group at http://groups.google.com/group/nhusers?hl=en. > >> > For more options, visit https://groups.google.com/groups/opt_out. > >> > > >> > > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "nhusers" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to [email protected] <javascript:>. > > To post to this group, send email to [email protected]<javascript:>. > > > Visit this group at http://groups.google.com/group/nhusers?hl=en. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
