(Long) null,
Criteria.NOT_EQUAL);
DateTestPeer.doDelete(criteria);
// insert new DateTest object to db
DateTest dateTest = new DateTest();
Date now = new Date();
dateTest.setDateValue(now);
dateTest.setTimeValue(now);
dateTest.setTimestampValue(now);
dateTest.save();
DateFormat dateFormat = new SimpleDateFormat();
System.out.println(
"testDateTime() : set date to : "
+ dateFormat.format(now));
// reload dateTest from db
DateTest loadedDateTest
= DateTestPeer.retrieveByPK(dateTest.getPrimaryKey());
System.out.println(
"testDateTime() : retrieved date : "
+ dateFormat.format(loadedDateTest.getDateValue()));
System.out.println(
"testDateTime() : retrieved time : "
+ dateFormat.format(loadedDateTest.getTimeValue()));
System.out.println(
"testDateTime() : retrieved timestamp : "
+ dateFormat.format(loadedDateTest.getTimestampValue()));
// compute time differences between reloaded and original object
long dateDifference
= dateTest.getDateValue().getTime()
- loadedDateTest.getDateValue().getTime();
long timeDifference
= dateTest.getTimeValue().getTime()
- loadedDateTest.getTimeValue().getTime();
long timestampDifference
= dateTest.getTimestampValue().getTime()
- loadedDateTest.getTimestampValue().getTime();
System.out.println(
"testDateTime() : Date difference (ms): "
+ dateDifference);
System.out.println(