long delta = nowTime.getTime() - testRead.getTimeColumn().getTime();
assertTrue("" + delta, Math.abs(delta) <= 1000 * 60 * 60);
}
public void testTimestamp() throws Exception {
DateTestEntity test = context.newObject(DateTestEntity.class);
Calendar cal = Calendar.getInstance();
cal.clear();
cal.set(2003, 1, 1, 1, 20, 30);
// most databases fail millisecond accuracy
// cal.set(Calendar.MILLISECOND, 55);
Date now = cal.getTime();
test.setTimestampColumn(now);
context.commitChanges();
SelectQuery q = new SelectQuery(DateTestEntity.class);
DateTestEntity testRead = (DateTestEntity) context.performQuery(q).get(0);
assertNotNull(testRead.getTimestampColumn());
assertEquals(now, testRead.getTimestampColumn());
}