When using a CLOB data type in an order by comparator, we need to cast it. In Hibernate's parsing to parse the query, they can often remove the space after the casting call and the asc. This is not normally a problem, however Hibernate uses the current Dialect's getLimitString function in order to get the string used to work with sorting results. However our implementation of getLimitString (SQLServerLimitStringUtil depends on looking for the last space in order to parse out the ASC/DESC operators. However since the Util takes into account both inner and outer order bys, it is unsure if a simple substring compare will not cause more bugs to occur).
Steps to Reproduce
- Run DataLayoutResourceTest.testGetDataDefinitionDataLayoutsPageWithSortString on SQLServer
Test fails because Hibernate cannot parse the SQL due to SQLServerLimitStringUtil appending an extra ASC
Tested on Tomcat 9.0.17 + SQL Server 2019
Portal master GIT ID: cd88252c3891fd40e757e2c658ef6c1c7b257f9a