Book b = newBook();
HasKeyPkJPA hasKeyPk = new HasKeyPkJPA();
HasOneToOneStringPkParentJPA hasParent = new HasOneToOneStringPkParentJPA();
HasOneToOneStringPkParentKeyPkJPA hasParentKeyPk = new HasOneToOneStringPkParentKeyPkJPA();
HasOneToOneStringPkJPA pojo = new HasOneToOneStringPkJPA();
pojo.setId("yar");
pojo.setBook(b);
pojo.setHasKeyPK(hasKeyPk);
pojo.setHasParent(hasParent);
hasParent.setParent(pojo);
pojo.setHasParentKeyPK(hasParentKeyPk);
hasParentKeyPk.setParent(pojo);
startEnd.start();
em.persist(pojo);
startEnd.end();
assertNotNull(b.getId());
assertNotNull(hasKeyPk.getId());
assertNotNull(hasParent.getId());
assertNotNull(hasParentKeyPk.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.getClass(), pojo.getId(), bookEntity, b.getId());
Entity hasKeyPkEntity = ds.get(hasKeyPk.getId());
assertNotNull(hasKeyPkEntity);
assertEquals(hasKeyPk.getId(), hasKeyPkEntity.getKey());
assertKeyParentEquals(pojo.getClass(), pojo.getId(), hasKeyPkEntity, hasKeyPk.getId());
Entity hasParentEntity = ds.get(KeyFactory.stringToKey(hasParent.getId()));
assertNotNull(hasParentEntity);
assertEquals(KeyFactory.stringToKey(hasParent.getId()), hasParentEntity.getKey());
assertKeyParentEquals(pojo.getClass(), pojo.getId(), hasParentEntity, hasParent.getId());
Entity hasParentKeyPkEntity = ds.get(hasParentKeyPk.getId());
assertNotNull(hasParentKeyPkEntity);
assertEquals(hasParentKeyPk.getId(), hasParentKeyPkEntity.getKey());
assertKeyParentEquals(pojo.getClass(), pojo.getId(), hasParentKeyPkEntity, hasParentKeyPk.getId());
Entity pojoEntity = ds.get(TestUtils.createKey(pojo, pojo.getId()));
assertNotNull(pojoEntity);
assertEquals(bookEntity.getKey(), pojoEntity.getProperty("book_id"));
assertEquals(hasKeyPkEntity.getKey(), pojoEntity.getProperty("haskeypk_id"));
assertEquals(hasParentEntity.getKey(), pojoEntity.getProperty("hasparent_id"));
assertEquals(hasParentKeyPkEntity.getKey(), pojoEntity.getProperty("hasparentkeypk_id"));