use of org.hibernate.query.sqm.tree.select.SqmSortSpecification in project hibernate-orm by hibernate.
the class FromClauseTests method testFromElementReferenceInOrderBy.
@Test
public void testFromElementReferenceInOrderBy() {
final String query = "select p from Person p order by p";
SqmSelectStatement<?> selectStatement = interpretSelect(query);
final SqmFromClause fromClause = selectStatement.getQuerySpec().getFromClause();
assertThat(fromClause, notNullValue());
assertThat(fromClause.getRoots(), hasSize(1));
final List<SqmSortSpecification> orderBy = selectStatement.getQuerySpec().getOrderByClause().getSortSpecifications();
assertThat(orderBy, hasSize(1));
assertThat(orderBy.get(0).getSortExpression(), instanceOf(SqmRoot.class));
}
Aggregations