}
public void testOneToOnePersistCascadeRemove() throws EntityNotFoundException {
switchDatasource(EntityManagerFactoryName.nontransactional_ds_non_transactional_ops_not_allowed);
HasKeyAncestorKeyPkJPA child = new HasKeyAncestorKeyPkJPA();
beginTxn();
em.persist(child);
commitTxn();
HasOneToOnesWithDifferentCascadesJPA parent = new HasOneToOnesWithDifferentCascadesJPA();
parent.setCascadeRemoveChild(child);
beginTxn();
em.persist(parent);
try {
commitTxn();
fail("expected exception");
} catch (PersistenceException e) {
// good
rollbackTxn();
}
Entity childEntity = ds.get(child.getKey());
assertKeyParentNull(childEntity, childEntity.getKey());
}