switchDatasource(PersistenceManagerFactoryName.nontransactional);
getExecutionContext().setProperty(PROP_DETACH_ON_CLOSE, true);
testInsert_NewParentAndChild_StringPk(NEW_PM_START_END);
}
private void testInsert_NewParentAndChild_StringPk(StartEnd startEnd) throws EntityNotFoundException {
BidirectionalChildStringPkListJDO bidirChild = new BidirectionalChildStringPkListJDO();
bidirChild.setChildVal("yam");
Flight f = newFlight();
HasKeyPkJDO hasKeyPk = new HasKeyPkJDO();
hasKeyPk.setStr("yag");
HasOneToManyStringPkListJDO parent = new HasOneToManyStringPkListJDO();
parent.setId("yar");
parent.addBidirChild(bidirChild);
bidirChild.setParent(parent);
parent.addFlight(f);
parent.addHasKeyPk(hasKeyPk);
parent.setVal("yar");
startEnd.start();
pm.makePersistent(parent);
startEnd.end();
assertNotNull(bidirChild.getId());
assertNotNull(f.getId());
assertNotNull(hasKeyPk.getKey());
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());
// TODO This is only for older storage versions; check owner relation List positions for current
if (isIndexed() &&
getStorageVersion(pm).ordinal() < StorageVersion.READ_OWNED_CHILD_KEYS_FROM_PARENTS.ordinal()) {
assertEquals(0L, bidirChildEntity.getProperty("bidirChildren_INTEGER_IDX"));