Search in sources :

Example 1 with EnumEntity

use of org.apache.cayenne.testdo.enum_test.EnumEntity in project cayenne by apache.

the class EnumIT method testInsert.

@Test
public void testInsert() {
    EnumEntity e = context.newObject(EnumEntity.class);
    e.setEnumAttribute(Enum1.one);
    context.commitChanges();
}
Also used : EnumEntity(org.apache.cayenne.testdo.enum_test.EnumEntity) Test(org.junit.Test)

Example 2 with EnumEntity

use of org.apache.cayenne.testdo.enum_test.EnumEntity in project cayenne by apache.

the class EnumIT method testSelectQuery.

@Test
public void testSelectQuery() throws Exception {
    createDataSet();
    SelectQuery q = new SelectQuery(EnumEntity.class);
    q.andQualifier(EnumEntity.ENUM_ATTRIBUTE.eq(Enum1.one));
    EnumEntity e = (EnumEntity) Cayenne.objectForQuery(context, q);
    assertNotNull(e);
    assertSame(Enum1.one, e.getEnumAttribute());
}
Also used : SelectQuery(org.apache.cayenne.query.SelectQuery) EnumEntity(org.apache.cayenne.testdo.enum_test.EnumEntity) Test(org.junit.Test)

Example 3 with EnumEntity

use of org.apache.cayenne.testdo.enum_test.EnumEntity in project cayenne by apache.

the class EnumIT method testSQLTemplate.

@Test
public void testSQLTemplate() throws Exception {
    createDataSet();
    SQLTemplate q = new SQLTemplate(EnumEntity.class, "SELECT * FROM ENUM_ENTITY WHERE ENUM_ATTRIBUTE = 'one'");
    q.setColumnNamesCapitalization(CapsStrategy.UPPER);
    EnumEntity e = (EnumEntity) Cayenne.objectForQuery(context, q);
    assertNotNull(e);
    assertSame(Enum1.one, e.getEnumAttribute());
}
Also used : SQLTemplate(org.apache.cayenne.query.SQLTemplate) EnumEntity(org.apache.cayenne.testdo.enum_test.EnumEntity) Test(org.junit.Test)

Aggregations

EnumEntity (org.apache.cayenne.testdo.enum_test.EnumEntity)3 Test (org.junit.Test)3 SQLTemplate (org.apache.cayenne.query.SQLTemplate)1 SelectQuery (org.apache.cayenne.query.SelectQuery)1