public void testToOneSeriesFlattenedRel() {
FlattenedTest1 ft1 = (FlattenedTest1) context.newObject("FlattenedTest1");
ft1.setName("FT1Name");
FlattenedTest2 ft2 = (FlattenedTest2) context.newObject("FlattenedTest2");
ft2.setName("FT2Name");
FlattenedTest3 ft3 = (FlattenedTest3) context.newObject("FlattenedTest3");
ft3.setName("FT3Name");
ft2.setToFT1(ft1);
ft2.addToFt3Array(ft3);
context.commitChanges();
context = createDataContext(); // We need a new context
SelectQuery q = new SelectQuery(FlattenedTest3.class);
q.setQualifier(ExpressionFactory.matchExp("name", "FT3Name"));
List results = context.performQuery(q);
assertEquals(1, results.size());
FlattenedTest3 fetchedFT3 = (FlattenedTest3) results.get(0);
FlattenedTest1 fetchedFT1 = fetchedFT3.getToFT1();
assertEquals("FT1Name", fetchedFT1.getName());
}