use of org.apache.cayenne.query.Ordering in project cayenne by apache.
the class OrderingTranslatorIT method testAppendPart4.
/**
* Tests ascending case-insensitive ordering on string attribute.
*/
@Test
public void testAppendPart4() throws Exception {
Ordering o1 = new Ordering("artistName", SortOrder.ASCENDING_INSENSITIVE);
doTestAppendPart("UPPER(ta.ARTIST_NAME)", o1);
}
use of org.apache.cayenne.query.Ordering in project cayenne by apache.
the class OrderingTranslatorIT method testAppendPart5.
@Test
public void testAppendPart5() throws Exception {
Ordering o1 = new Ordering("artistName", SortOrder.DESCENDING_INSENSITIVE);
Ordering o2 = new Ordering("paintingArray.estimatedPrice", SortOrder.ASCENDING);
doTestAppendPart("UPPER(ta.ARTIST_NAME) DESC, ta.ESTIMATED_PRICE", o1, o2);
}
use of org.apache.cayenne.query.Ordering in project cayenne by apache.
the class OrderingTranslatorIT method testAppendPart6.
@Test
public void testAppendPart6() throws Exception {
Ordering o1 = new Ordering("artistName", SortOrder.ASCENDING_INSENSITIVE);
Ordering o2 = new Ordering("paintingArray.estimatedPrice", SortOrder.ASCENDING_INSENSITIVE);
doTestAppendPart("UPPER(ta.ARTIST_NAME), UPPER(ta.ESTIMATED_PRICE)", o1, o2);
}
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);
}
Aggregations