criteria.where(
InheritanceClassnameTestPeer.INHERITANCE_TEST,
null,
Criteria.ISNOTNULL);
assertEquals(0,
new CountHelper().count(criteria));
// create & save test data
InheritanceClassnameTest inheritanceClassnameTest
= new InheritanceClassnameTest();
inheritanceClassnameTest.setPayload("0 parent");
inheritanceClassnameTest.save();
InheritanceClassnameTestChild1 inheritanceClassnameChild1
= new InheritanceClassnameTestChild1();
inheritanceClassnameChild1.setPayload("1 child");
inheritanceClassnameChild1.save();
InheritanceClassnameTestChild2 inheritanceClassnameChild2
= new InheritanceClassnameTestChild2();
inheritanceClassnameChild2.setPayload("2 child");
inheritanceClassnameChild2.save();
// Check that all objects are saved into the InheritanceTest table
criteria = new Criteria();
criteria.where(
InheritanceClassnameTestPeer.INHERITANCE_TEST,
null,
Criteria.ISNOTNULL);
assertEquals("InheritanceClassnameTest table should contain 3 rows",
3,
new CountHelper().count(criteria));
criteria = new Criteria();
criteria.addAscendingOrderByColumn(
InheritanceClassnameTestPeer.PAYLOAD);
// Check that the class of the object is retained when loading