Could anybody please explain why NHibernate on MsSql2012Dialect
generates query that can not be processed by server? It builds query this way when there is no sorting specified explicitly.
...
ORDER BY CURRENT_TIMESTAMP
OFFSET 0 ROWS FETCH FIRST 10 ROWS ONLY
This is unresolved bug registered in jira, based on the suggestions, this is my work around:
public class MyMsSql2012Dialect : MsSql2012Dialect
{
public override SqlString GetLimitString(SqlString querySqlString, SqlString offset, SqlString limit)
{
var result = base.GetLimitString(querySqlString, offset, limit);
return result.Replace("ORDER BY CURRENT_TIMESTAMP", "ORDER BY 1");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With