public void testDeleteExpression() {
    if (isOnServer()) {
      // Not work on server.
      return;
    }
    if ((JUnitTestCase.getServerSession()).getPlatform().isSymfoware()) {
      getServerSession()
          .logMessage(
              "Test testDeleteExpression skipped for this platform, "
                  + "Symfoware doesn't support UpdateAll/DeleteAll on multi-table objects (see rfe 298193).");
      return;
    }

    JpaEntityManager em = (org.eclipse.persistence.jpa.JpaEntityManager) createEntityManager();
    try {
      beginTransaction(em);
      String orderString = "DELETE FROM OrderBean o WHERE o.customer.name ='Karen McDonald' ";
      em.createQuery(orderString).executeUpdate();
      orderString = "DELETE FROM OrderBean o WHERE o.billedCustomer.name ='Karen McDonald' ";
      em.createQuery(orderString).executeUpdate();
      String ejbqlString = "DELETE FROM Customer c WHERE c.name='Karen McDonald' ";
      int result = em.createQuery(ejbqlString).executeUpdate();
      Assert.assertEquals("Delete Expression test failed: customer to delete not found", 1, result);
      em.flush();

      ReadAllQuery raq = new ReadAllQuery(Customer.class, new ExpressionBuilder());
      Expression whereClause = raq.getExpressionBuilder().get("name").equal("Karen McDonald");
      raq.setSelectionCriteria(whereClause);
      List customerFound = (List) em.getActiveSession().executeQuery(raq);
      Assert.assertEquals("Delete Expression test failed", 0, customerFound.size());
    } finally {
      rollbackTransaction(em);
    }
  }
 public void testEL254937() {
   EntityManager em = createEntityManager(m_persistenceUnit);
   beginTransaction(em);
   LargeProject lp1 = new LargeProject();
   lp1.setName("one");
   em.persist(lp1);
   commitTransaction(em);
   em = createEntityManager(m_persistenceUnit);
   beginTransaction(em);
   em.remove(em.find(LargeProject.class, lp1.getId()));
   em.flush();
   JpaEntityManager eclipselinkEm = (JpaEntityManager) em.getDelegate();
   RepeatableWriteUnitOfWork uow = (RepeatableWriteUnitOfWork) eclipselinkEm.getActiveSession();
   // duplicate the beforeCompletion call
   uow.issueSQLbeforeCompletion();
   // commit the transaction
   uow.setShouldTerminateTransaction(true);
   uow.commitTransaction();
   // duplicate the AfterCompletion call.  This should merge, removing the LargeProject from the
   // shared cache
   uow.mergeClonesAfterCompletion();
   em = createEntityManager(m_persistenceUnit);
   LargeProject cachedLargeProject = em.find(LargeProject.class, lp1.getId());
   closeEntityManager(em);
   assertTrue(
       "Entity removed during flush was not removed from the shared cache on commit",
       cachedLargeProject == null);
 }