Book b = newBook();
HasKeyPkJPA hasKeyPk = new HasKeyPkJPA();
hasKeyPk.setStr("yag");
HasOneToManyStringPkListJPA parent = new HasOneToManyStringPkListJPA();
parent.setId("yar");
parent.getBidirChildren().add(bidirChild);
bidirChild.setParent(parent);
parent.getBooks().add(b);
parent.getHasKeyPks().add(hasKeyPk);
parent.setVal("yar");
startEnd.start();
em.persist(parent);
startEnd.end();
assertNotNull(bidirChild.getId());
assertNotNull(b.getId());
assertNotNull(hasKeyPk.getId());
Entity bidirChildEntity = ds.get(KeyFactory.stringToKey(bidirChild.getId()));
assertNotNull(bidirChildEntity);
assertEquals("yam", bidirChildEntity.getProperty("childVal"));
assertEquals(KeyFactory.stringToKey(bidirChild.getId()), bidirChildEntity.getKey());
assertKeyParentEquals(parent.getClass(), parent.getId(), bidirChildEntity, bidirChild.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(parent.getClass(), parent.getId(), bookEntity, b.getId());
Entity hasKeyPkEntity = ds.get(hasKeyPk.getId());
assertNotNull(hasKeyPkEntity);
assertEquals("yag", hasKeyPkEntity.getProperty("str"));
assertEquals(hasKeyPk.getId(), hasKeyPkEntity.getKey());
assertKeyParentEquals(parent.getClass(), parent.getId(), hasKeyPkEntity, hasKeyPk.getId());
Entity parentEntity = ds.get(TestUtils.createKey(parent, parent.getId()));
assertNotNull(parentEntity);
assertEquals(4, parentEntity.getProperties().size());
assertEquals("yar", parentEntity.getProperty("val"));
assertEquals(Utils.newArrayList(bidirChildEntity.getKey()), parentEntity.getProperty("bidirChildren"));
assertEquals(Utils.newArrayList(bookEntity.getKey()), parentEntity.getProperty("books"));