Search in sources :

Example 1 with CAY2666

use of org.apache.cayenne.testdo.cay_2666.CAY2666 in project cayenne by apache.

the class Cay2666IT method testExpressionWithDollarSign.

@Test
public void testExpressionWithDollarSign() throws Exception {
    tTest = new TableHelper(dbHelper, "Cay2666");
    tTest.setColumns("ID", "NAME$");
    tTest.insert(1, "st.One");
    Expression expression = ExpressionFactory.exp("name$ = 'st.One'");
    List<CAY2666> cay2666List = ObjectSelect.query(CAY2666.class).where(expression).select(context);
    assertEquals(1, cay2666List.size());
    expression = ExpressionFactory.exp("obj:name$ = 'st.Two'");
    cay2666List = ObjectSelect.query(CAY2666.class).where(expression).select(context);
    assertEquals(0, cay2666List.size());
    tTest.insert(2, "st.Two");
    expression = ExpressionFactory.exp("db:NAME$ = 'st.Two'");
    cay2666List = ObjectSelect.query(CAY2666.class).where(expression).select(context);
    assertEquals(1, cay2666List.size());
}
Also used : Expression(org.apache.cayenne.exp.Expression) CAY2666(org.apache.cayenne.testdo.cay_2666.CAY2666) TableHelper(org.apache.cayenne.test.jdbc.TableHelper) Test(org.junit.Test)

Aggregations

Expression (org.apache.cayenne.exp.Expression)1 TableHelper (org.apache.cayenne.test.jdbc.TableHelper)1 CAY2666 (org.apache.cayenne.testdo.cay_2666.CAY2666)1 Test (org.junit.Test)1