}
public void testChildAtMultipleLevels_NoTxn() throws EntityNotFoundException {
testChildAtMultipleLevels(NEW_EM_START_END);
}
private void testChildAtMultipleLevels(StartEnd startEnd) throws EntityNotFoundException {
HasOneToOneChildAtMultipleLevelsJPA pojo = new HasOneToOneChildAtMultipleLevelsJPA();
Book b1 = new Book();
pojo.setBook(b1);
HasOneToOneChildAtMultipleLevelsJPA child = new HasOneToOneChildAtMultipleLevelsJPA();
Book b2 = new Book();
child.setBook(b2);
pojo.setChild(child);
startEnd.start();
em.persist(pojo);
startEnd.end();
startEnd.start();
pojo = em.find(HasOneToOneChildAtMultipleLevelsJPA.class, pojo.getId());
assertEquals(b1.getId(), pojo.getBook().getId());
assertEquals(child.getId(), pojo.getChild().getId());
assertEquals(child.getBook(), b2);
assertNull(child.getChild());
startEnd.end();
Entity pojoEntity = ds.get(pojo.getId());
Entity childEntity = ds.get(child.getId());
Entity book1Entity = ds.get(KeyFactory.stringToKey(b1.getId()));
Entity book2Entity = ds.get(KeyFactory.stringToKey(b2.getId()));
assertEquals(book1Entity.getKey(), pojoEntity.getProperty("book_id"));
assertEquals(childEntity.getKey(), pojoEntity.getProperty("child_id"));
assertEquals(book2Entity.getKey(), childEntity.getProperty("book_id"));