use of org.apache.cayenne.query.Ordering in project cayenne by apache.
the class OrderingTranslatorIT method testAppendFunctionExpression1.
@Test
public void testAppendFunctionExpression1() throws Exception {
Ordering o1 = new Ordering(FunctionExpressionFactory.absExp("paintingArray.estimatedPrice"));
doTestAppendPart("ABS(ta.ESTIMATED_PRICE)", o1);
}
use of org.apache.cayenne.query.Ordering in project cayenne by apache.
the class OrderingTranslatorIT method testAppendIllegalExpression.
@Test(expected = CayenneRuntimeException.class)
public void testAppendIllegalExpression() throws Exception {
Ordering o1 = new Ordering(ExpressionFactory.and(ExpressionFactory.expTrue(), ExpressionFactory.expFalse()));
// should throw exception
doTestAppendPart("TRUE AND FALSE", o1);
}
use of org.apache.cayenne.query.Ordering in project cayenne by apache.
the class OrderingTranslatorIT method testAppendPart1.
/**
* Tests ascending ordering on string attribute.
*/
@Test
public void testAppendPart1() throws Exception {
Ordering o1 = new Ordering("artistName", SortOrder.ASCENDING);
doTestAppendPart("ta.ARTIST_NAME", o1);
}
use of org.apache.cayenne.query.Ordering in project cayenne by apache.
the class OrderingTranslatorIT method testAppendPart2.
/**
* Tests descending ordering on string attribute.
*/
@Test
public void testAppendPart2() throws Exception {
Ordering o1 = new Ordering("artistName", SortOrder.DESCENDING);
doTestAppendPart("ta.ARTIST_NAME DESC", o1);
}
use of org.apache.cayenne.query.Ordering in project cayenne by apache.
the class OrderingTranslatorIT method testAppendPart3.
@Test
public void testAppendPart3() throws Exception {
Ordering o1 = new Ordering("artistName", SortOrder.DESCENDING);
Ordering o2 = new Ordering("paintingArray.estimatedPrice", SortOrder.ASCENDING);
doTestAppendPart("ta.ARTIST_NAME DESC, ta.ESTIMATED_PRICE", o1, o2);
}
Aggregations