use of org.apache.cayenne.testdo.mt.MtTable1Subclass1 in project cayenne by apache.
the class ValueInjectorIT method testServer.
@Test
public void testServer() {
ObjEntity entity = serverContext.getEntityResolver().getObjEntity(MtTable1Subclass1.class);
Expression qualifier = entity.getDeclaredQualifier();
try {
MtTable1Subclass1 ee = serverContext.newObject(MtTable1Subclass1.class);
assertEquals(ee.getGlobalAttribute1(), "sub1");
// check AND
entity.setDeclaredQualifier(qualifier.andExp(ExpressionFactory.exp("serverAttribute1 = 'sa'")));
ee = serverContext.newObject(MtTable1Subclass1.class);
assertEquals(ee.getGlobalAttribute1(), "sub1");
assertEquals(ee.getServerAttribute1(), "sa");
} finally {
entity.setDeclaredQualifier(qualifier);
}
}
use of org.apache.cayenne.testdo.mt.MtTable1Subclass1 in project cayenne by apache.
the class SelectQueryAbstractEntityIT method test1AbstractEntitySelect.
@Test
public void test1AbstractEntitySelect() throws Exception {
createDataSet();
SelectQuery<MtTable1> query = new SelectQuery<MtTable1>(MtTable1.class);
final List<MtTable1> list = context.select(query);
assertNotNull(list);
for (MtTable1 sub : list) {
if (sub instanceof MtTable1Subclass1) {
assertNotNull(((MtTable1Subclass1) sub).getSubclass1Attribute1());
}
}
}
Aggregations