private ApplicationContext context;
private void test() {
System.out.println("Getting testDao");
TestDao testDao = (TestDao)context.getBean("testDao");
Date today = Calendar.getInstance().getTime();
System.out.println("Inserting new Test record");
Test test = new Test();
test.setName("new one");
test.setRunDate(today);
testDao.save(test);
System.out.println("Test inserted " + test);
List tests = testDao.getAll();
for (Iterator i = tests.iterator(); i.hasNext();) {
test = (Test)i.next();
System.out.println(test);
}
long startMillis = System.currentTimeMillis();
for (int i = 0; i < 25000; i++) {
testDao.getByNameAndRunDate("foo", today);
}
System.out.println("Took " + (System.currentTimeMillis() - startMillis) + " ms");
startMillis = System.currentTimeMillis();
for (int i = 0; i < 5000; i++) {
testDao.updateName(1, "foobar");
}
System.out.println("Took " + (System.currentTimeMillis() - startMillis) + " ms");
}