SelectQuery query = new SelectQuery(Painting.class);
query.addPrefetch(Painting.TO_PAINTING_INFO_PROPERTY);
List daos = ctxt.performQuery(query);
assertTrue(!daos.isEmpty());
for (Iterator it = daos.iterator(); it.hasNext();) {
Painting p = (Painting) it.next();
PaintingInfo pi = p.getToPaintingInfo();
assertEquals("persistence state", PersistenceState.COMMITTED, p
.getPersistenceState());
assertEquals("persistence state", PersistenceState.COMMITTED, pi
.getPersistenceState());
}
}