String fullTableNameD = dict.getFullName(mappingD.getTable(), false);
String pkColNameD = mappingD.getTable().getPrimaryKey().
getColumns()[0].getName();
pm = (OpenJPAEntityManager)currentEntityManager();
OpenJPAQuery q = pm.createQuery("javax.jdo.query.SQL",
"select t0.*, t1.* from "
+ fullTableNameA + " t0, "
+ fullTableNameD + " t1 "
+ "where t0." + relColNameA + " = t1." + pkColNameD);
// even the exact same SQL that Kodo generates will not
// eagerly load the relation
/*
q = pm.newQuery ("javax.jdo.query.SQL",
"SELECT t1.ID, t1.TYP, t1.VERSN, t1.ADBL, t1.AINT, "
+ "t1.ASTR, t1.BDBL, t1.BINT, t1.BSTR, t1.CDBL, t1.CINT, "
+ "t1.CSTR, t0.DDBL, t0.DINT, t0.DSTR "
+ "FROM ATTACHD t0 LEFT OUTER JOIN ATTACHA t1 ON t0.A = t1.ID");
*/
q.setResultClass(AttachD.class);
Iterator itr = ((Collection) q.getCandidateCollection()).iterator();
assertTrue(itr.hasNext());
d = (AttachD) itr.next();
// d.getDstr ();
OpenJPAStateManager sm = getStateManager(d, pm);
assertTrue(sm.getLoaded().
get(sm.getMetaData().getField("a").getIndex()));
assertNotNull(d.getA());
assertFalse(itr.hasNext());
q.closeAll();
pm.close();
}