}
private void testInsert_NewParentAndChild(StartEnd startEnd) throws Exception {
Book b = newBook();
HasKeyPkJPA hasKeyPk = new HasKeyPkJPA();
HasOneToOneParentJPA hasParent = new HasOneToOneParentJPA();
HasOneToOneParentKeyPkJPA hasParentKeyPk = new HasOneToOneParentKeyPkJPA();
HasEncodedStringPkJPA notDependent = new HasEncodedStringPkJPA();
HasOneToOneJPA pojo = new HasOneToOneJPA();
pojo.setBook(b);
pojo.setHasKeyPK(hasKeyPk);
pojo.setHasParent(hasParent);
hasParent.setParent(pojo);
pojo.setHasParentKeyPK(hasParentKeyPk);
hasParentKeyPk.setParent(pojo);
pojo.setNotDependent(notDependent);
startEnd.start();
em.persist(pojo);
startEnd.end();
assertNotNull(b.getId());
assertNotNull(hasKeyPk.getId());
assertNotNull(hasParent.getId());
assertNotNull(hasParentKeyPk.getId());
assertNotNull(notDependent.getId());
assertNotNull(pojo.getId());
Entity bookEntity = ds.get(KeyFactory.stringToKey(b.getId()));
assertNotNull(bookEntity);
assertEquals("max", bookEntity.getProperty("author"));
assertEquals("22333", bookEntity.getProperty("isbn"));
assertEquals("yam", bookEntity.getProperty("title"));
assertEquals(KeyFactory.stringToKey(b.getId()), bookEntity.getKey());
assertKeyParentEquals(pojo.getId(), bookEntity, b.getId());
Entity hasKeyPkEntity = ds.get(hasKeyPk.getId());
assertNotNull(hasKeyPkEntity);
assertEquals(hasKeyPk.getId(), hasKeyPkEntity.getKey());
assertKeyParentEquals(pojo.getId(), hasKeyPkEntity, hasKeyPk.getId());
Entity hasParentEntity = ds.get(KeyFactory.stringToKey(hasParent.getId()));
assertNotNull(hasParentEntity);
assertEquals(KeyFactory.stringToKey(hasParent.getId()), hasParentEntity.getKey());
assertKeyParentEquals(pojo.getId(), hasParentEntity, hasParent.getId());
Entity hasParentKeyPkEntity = ds.get(hasParentKeyPk.getId());
assertNotNull(hasParentKeyPkEntity);
assertEquals(hasParentKeyPk.getId(), hasParentKeyPkEntity.getKey());
assertKeyParentEquals(pojo.getId(), hasParentKeyPkEntity, hasParentKeyPk.getId());
Entity notDependentEntity = ds.get(KeyFactory.stringToKey(notDependent.getId()));
assertNotNull(notDependentEntity);
Entity pojoEntity = ds.get(KeyFactory.stringToKey(pojo.getId()));