/** */
public void testConcreteSuperclassExact() {
if (!runsWithApplicationIdentity()) return;
Transaction tx = null;
Person instance = null;
try {
pm = getPM();
pm.currentTransaction().begin();
// create the oid
Object superclassOid = new LongIdentity(Person.class, id);
instance = (Person)pm.getObjectById(superclassOid, false);
if (instance.getClass() != Person.class) {
appendMessage(ASSERTION_FAILED + "getObjectById exact for "
+ "concrete superclass should return "
+ "Person.class but returned wrong type "
+ instance.getClass().getName());
}
} catch (Exception ex) {
appendMessage(ASSERTION_FAILED + "getObjectById exact for " +
"concrete superclass must succeed before accessing database.");
}
try {
instance.toString(); // accesses non-key fields
appendMessage(ASSERTION_FAILED + "getObjectById exact for "
+ "concrete superclass must fail when accessing database.");
} catch (JDOException ex) {
// good catch
}