public void testFetchRelationshipBinaryPK() throws Exception {
if (!getAccessStackAdapter().supportsBinaryPK()) {
return;
}
BinaryPKTest1 master = (BinaryPKTest1) context.newObject("BinaryPKTest1");
master.setName("master1");
BinaryPKTest2 detail = (BinaryPKTest2) context.newObject("BinaryPKTest2");
detail.setDetailName("detail2");
master.addToBinaryPKDetails(detail);
context.commitChanges();
// create new context
context = createDataContext();
BinaryPKTest2 fetchedDetail = (BinaryPKTest2) context.performQuery(
new SelectQuery(BinaryPKTest2.class)).get(0);
assertNotNull(fetchedDetail.readPropertyDirectly("toBinaryPKMaster"));
BinaryPKTest1 fetchedMaster = fetchedDetail.getToBinaryPKMaster();
assertNotNull(fetchedMaster);
assertEquals(PersistenceState.HOLLOW, fetchedMaster.getPersistenceState());
assertEquals("master1", fetchedMaster.getName());
}