nhibernate/nhibernate-core — pull request #251 by ggeurts (2014-01-24 16:26:53+00:00)
Title: Fix for NH-3594: MsSql2012Dialect generates invalid SELECT DISTINCT paging or limit queries 

See https://nhibernate.jira.com/browse/NH-3594. Testing with SQL Server configuration that uses SQL Server 2012 and the MsSql2012Dialect causes 2 tests to fail.

This pull request modifies the generated SQL for SELECT DISTINCT queries that have paging or limit clauses but miss an explicit ORDER BY clause. Instead of inserting an ORDER BY CURRENT_TIMESTAMP clause, it inserts an ORDER BY 1 clause to ensure that the ORDER BY clause always refers to the first column in the SELECT clause.

Note, this is a breaking change for queries that rely on the current **undefined** ordering behaviour of SELECT queries for which no sort order has been specified.