use of org.apache.cayenne.testdo.date_time.DateTestEntity in project cayenne by apache.
the class ASTFunctionCallDateIT method testCurrentTime.
@Test
public void testCurrentTime() throws Exception {
Expression exp = ExpressionFactory.greaterOrEqualExp("timeColumn", new ASTCurrentTime());
List<DateTestEntity> res = ObjectSelect.query(DateTestEntity.class, exp).select(context);
if (!unitDbAdapter.supportsTimeSqlType()) {
// result will be invalid most likely as DB doesn't support TIME data type
return;
}
assertEquals(1, res.size());
DateTestEntity res1 = res.get(0);
Expression exp2 = ExpressionFactory.lessExp("timeColumn", new ASTCurrentTime());
DateTestEntity res2 = ObjectSelect.query(DateTestEntity.class, exp2).selectOne(context);
assertNotNull(res2);
assertNotEquals(res1, res2);
}
use of org.apache.cayenne.testdo.date_time.DateTestEntity in project cayenne by apache.
the class ASTFunctionCallDateIT method testCurrentDate.
@Test
public void testCurrentDate() throws Exception {
Expression exp = ExpressionFactory.greaterOrEqualExp("dateColumn", new ASTCurrentDate());
DateTestEntity res1 = ObjectSelect.query(DateTestEntity.class, exp).selectOne(context);
assertNotNull(res1);
Expression exp2 = ExpressionFactory.lessExp("dateColumn", new ASTCurrentDate());
DateTestEntity res2 = ObjectSelect.query(DateTestEntity.class, exp2).selectOne(context);
assertNotNull(res2);
assertNotEquals(res1, res2);
}
Aggregations