HHH-6767: Added guard to ensure the DB is not SQL SErver before adding ORDER BY clause to SQL
This commit is contained in:
parent
dfd718418c
commit
b31c17b332
|
@ -50,6 +50,7 @@ import org.hibernate.criterion.Projections;
|
|||
import org.hibernate.criterion.Property;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.hibernate.criterion.Subqueries;
|
||||
import org.hibernate.dialect.SQLServerDialect;
|
||||
import org.hibernate.exception.SQLGrammarException;
|
||||
import org.hibernate.internal.util.SerializationHelper;
|
||||
import org.hibernate.test.hql.Animal;
|
||||
|
@ -212,7 +213,8 @@ public class CriteriaQueryTest extends BaseCoreFunctionalTestCase {
|
|||
|
||||
dc4.getExecutableCriteria( session ).list();
|
||||
|
||||
dc4.getExecutableCriteria( session ).addOrder( Order.asc( "stname" ) ).list();
|
||||
// SQL Server doesn't normally support ORDER BY in subqueries...
|
||||
if (!(getDialect() instanceof SQLServerDialect)) dc4.getExecutableCriteria(session).addOrder(Order.asc("stname")).list();
|
||||
|
||||
session.createCriteria(Enrolment.class, "e")
|
||||
.add( Subqueries.eq("Gavin King", dc4) )
|
||||
|
|
Loading…
Reference in New Issue