From: Mariusz F. (JIRA) <nh...@gm...> - 2011-04-26 13:15:56
|
[ http://216.121.112.228/browse/NH-2676?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mariusz Florek updated NH-2676: ------------------------------- Attachment: Domain-Customer.zip 1. Create test SQL Server database using following script: http://switch.dl.sourceforge.net/project/nhibernate/NHibernate/3.1.0.GA/NHibernate-3.1.0.GA-bin.zip/Tests/DbScripts/MsSql2008DialectLinqReadonlyCreateScript.sql (I tested it in Express 2008 Version) 2. Domain classes, hbm and cfg is in an attachment (VS 2008 Windows Library Project) 3. Use code as follow for test: string q = @" from Customer c join fetch c.Orders as o left join fetch o.OrderLines as ol join fetch ol.Product p order by c.CompanyName "; var sf = // put ISessionFactory reference here for(int i = 0; i < 5; i++) { // var s = sf.OpenSession(); // works fine var s = sf.OpenStatelessSession(); try { var list = s.CreateQuery(q) .SetFirstResult(i) .SetMaxResults(1) .List<Customer>(); // always contains first entity regardless of SetFirstResult value (when stateless session used) } finally { s.Close(); } } > paged join fetch with OpenStatelessSession always results the same rows regardless of SetFirstRow parameter > ----------------------------------------------------------------------------------------------------------- > > Key: NH-2676 > URL: http://216.121.112.228/browse/NH-2676 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 3.1.0 > Reporter: Mariusz Florek > Priority: Major > Attachments: Domain-Customer.zip > > > I tested results of HQL query using standard and stateless session: > from Customer c > join fetch c.Orders as o > left join fetch o.OrderLines as ol > join fetch ol.Product p > order by c.CompanyName > I tried to limit result count using SetFirstResult(...) and SetMaxResults(...) on IQuery object. > For test I used MsSql2008DialectLinqReadonlyCreateScript.sql from NHibernate 3.1.0-GA zip with binaries. > With standard session I got proper results - with stateless session I always got first N (set with SetMaxResults) objects regardless of value set with SetFirstResult. > Additionally query ran with stateless session consumed twice execution time (although I expected it to be faster). > Problem exists also with simpler join example: > from Customer c > join fetch c.Orders > order by c.CompanyName > BTW - how NHibernate process such queries (how resolves page to read - I can see only not limited SQL generated)? > Cheers, > Mariusz -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |