public void testPersistenceContextRollback() {
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
TransactionStatus txStatus = txMgr.getTransaction(def);
TestEntity t = new TestEntity();
ParentTestEntity p = JPATestUtils.setMasterDetailRelationship(t);
Assert.assertFalse(entityManager.contains(t) || entityManager.contains(p), "Entities are not transient.");
entityManager.persist(p);
entityManager.persist(t);
Assert.assertTrue(entityManager.contains(t) && entityManager.contains(p), "Entities are not managed.");
txMgr.rollback(txStatus);