The 3.3.x branch has an unavoidable bug in the code that generates the 
limit statement for a MS SQL Server Query when comments are enabled.  

This code in MsSql2005DialectQueryPager (inherited by MsSql2008) throws an 
exception when the AutoCommentSql is set to true.  This is because the 
generated SQL includes a comment so startsWith fails.   

/* criteria query */ SELECT this_.Name as y0_ FROM Employee...


    private int GetAfterSelectInsertPoint()
    {
      if (_sourceQuery.StartsWithCaseInsensitive("select distinct"))
      {
        return 15;
      }
      if (_sourceQuery.StartsWithCaseInsensitive("select"))
      {
        return 6;
      }
      throw new NotSupportedException("The query should start with 'SELECT' 
or 'SELECT DISTINCT'");
    }

This issue was fixed in https://nhibernate.jira.com/browse/NH-2977 under 
commit 
https://github.com/nhibernate/nhibernate-core/commit/171ae483a3a0052806da42655991a34b4b56b8da
 It's 
worth noting that NH-2977 fixes a number of issues besides this specific 
problem.  

Since it's such an obvious problem, could we reconsider it for inclusion in 
3.3.3?   Would a smaller patch, just to this method (perhaps simply using 
IndexOf instead of StartsWith) be entertained for 3.3.x?   Because the 
issue is in a private method of an internal class, a custom dialect won't 
provide a very effective workaround; I need to actually change the 
NHibernate class.

Regards, Evan

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


Reply via email to