Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-dev] Fix for bug 242289

Migrated the following JPA tests running on application server:

- org.eclipse.persistence.testing.tests.jpa.advanced.AdvancedJPAJunitTest;
- org.eclipse.persistence.testing.tests.jpa.advanced.AdvancedJunitTest;
- org.eclipse.persistence.testing.tests.jpa.advanced.NamedNativeQueryJUnitTest;
- org.eclipse.persistence.testing.tests.jpa.advanced.CallbackEventJUnitTestSuite;
- org.eclipse.persistence.testing.tests.jpa.advanced.JoinedAttributeAdvancedJunitTest;
- org.eclipse.persistence.testing.tests.jpa.advanced.ReportQueryMultipleReturnTestSuite;
- org.eclipse.persistence.testing.tests.jpa.advanced.ExtendedPersistenceContextJUnitTestSuite;
- org.eclipse.persistence.testing.tests.jpa.advanced.ReportQueryConstructorExpressionTestSuite;
- org.eclipse.persistence.testing.tests.jpa.advanced.OptimisticConcurrencyJUnitTestSuite;
- org.eclipse.persistence.testing.tests.jpa.advanced.compositepk.AdvancedCompositePKJunitTest;
- org.eclipse.persistence.testing.tests.jpa.advanced.ReportQueryAdvancedJUnitTest;

- org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced.AdvancedJPAJunitTest;
- org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced.AdvancedJunitTest;
- org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced.CallbackEventJUnitTestSuite;
- org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced.ExtendedPersistenceContextJUnitTestSuite;
- org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced.JoinedAttributeAdvancedJunitTest;
- org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced.NamedNativeQueryJUnitTest;
- org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced.OptimisticConcurrencyJUnitTestSuite;
- org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced.ReportQueryAdvancedJUnitTest;
- org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced.ReportQueryConstructorExpressionTestSuite;
- org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced.ReportQueryMultipleReturnTestSuite;
- org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced.UpdateAllQueryAdvancedJunitTest;

- org.eclipse.persistence.testing.tests.jpa.inheritance.TablePerClassInheritanceJUnitTest

 
Code reviewed by: Edwin Tang
Patch attached.
 
Regards,
Kevin
Index: build.xml
===================================================================
--- build.xml	(revision 2970)
+++ build.xml	(working copy)
@@ -1105,6 +1105,7 @@
     <!-- Run all the JPA tests in the server -->
     <target name="server-test-lrg" depends="clean-test">
         <antcall target="server-test-advanced" inheritRefs="true"/>
+        <antcall target="server-test-advanced2" inheritRefs="true"/>
         <antcall target="server-test-datatypes" inheritRefs="true"/>
         <antcall target="server-test-datetime" inheritRefs="true"/>
         <antcall target="server-test-ddlgeneration" inheritRefs="true"/>
@@ -1137,6 +1138,19 @@
         </antcall>
     </target>
 
+    <target name="server-test-advanced2">
+        <antcall target="server-run-all" inheritRefs="true">
+            <param name="PERSISTENCE_UNIT_NAME" value="default"/>
+            <param name="MODEL_DIR" value="org/eclipse/persistence/testing/models/jpa/advanced"/>
+            <param name="MODEL_NAME" value="eclipselink-advanced-model"/>
+            <param name="TEST_DIR" value="org/eclipse/persistence/testing/tests/jpa/advanced"/>
+            <param name="TEST_NAME" value="eclipselink-advanced-model"/>
+            <param name="EAR_NAME" value="eclipselink-advanced-model"/>
+            <param name="TEST_SUITE" value="org.eclipse.persistence.testing.tests.jpa.advanced.EntityManagerJUnitTestSuite"/>
+            <param name="eclipselink.jpa.test.dir" value="."/>
+        </antcall>
+    </target>
+
     <target name="server-test-datatypes">
         <antcall target="server-run-all" inheritRefs="true">
             <param name="PERSISTENCE_UNIT_NAME" value="default"/>
@@ -1184,7 +1198,7 @@
             <param name="TEST_DIR" value="org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced"/>
             <param name="TEST_NAME" value="eclipselink-advanced-field-access-model"/>
             <param name="EAR_NAME" value="eclipselink-advanced-field-access-model"/>
-            <param name="TEST_SUITE" value="org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced.EntityManagerJUnitTestSuite"/>
+            <param name="TEST_SUITE" value="org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced.ServerTestSuite"/>
             <param name="eclipselink.jpa.test.dir" value="."/>
         </antcall>
     </target>
Index: src/org/eclipse/persistence/testing/tests/jpa/advanced/CacheImplJUnitTest.java
===================================================================
--- src/org/eclipse/persistence/testing/tests/jpa/advanced/CacheImplJUnitTest.java	(revision 2983)
+++ src/org/eclipse/persistence/testing/tests/jpa/advanced/CacheImplJUnitTest.java	(working copy)
@@ -51,25 +51,24 @@
         TestSuite suite = new TestSuite();
         suite.setName("CacheImplJUnitTest");
 
+        suite.addTest(new CacheImplJUnitTest("testSetup"));
         suite.addTest(new CacheImplJUnitTest("testContains"));
         suite.addTest(new CacheImplJUnitTest("testEvictClassObject"));
         suite.addTest(new CacheImplJUnitTest("testEvictClass"));
         suite.addTest(new CacheImplJUnitTest("testEvictAll"));
-        return new TestSetup(suite) {
-
-            protected void setUp() {
-                ServerSession session = JUnitTestCase.getServerSession();
-
-                new AdvancedTableCreator().replaceTables(session);
-            }
-
-            protected void tearDown() {
-                clearCache();
-            }
-        };
+        
+        return suite;
     }
-
+    
     /**
+     * The setup is done as a test, both to record its failure, and to allow execution in the server.
+     */
+    public void testSetup() {
+        new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession());
+        clearCache();
+    }
+    
+    /**
      * Test of contains method, of class CacheImpl.
      */
     public void testContains() {
Index: src/org/eclipse/persistence/testing/tests/jpa/advanced/JoinedAttributeAdvancedJunitTest.java
===================================================================
--- src/org/eclipse/persistence/testing/tests/jpa/advanced/JoinedAttributeAdvancedJunitTest.java	(revision 2983)
+++ src/org/eclipse/persistence/testing/tests/jpa/advanced/JoinedAttributeAdvancedJunitTest.java	(working copy)
@@ -114,18 +114,40 @@
     }
     
     public static Test suite() {
-        TestSuite suite = new TestSuite(JoinedAttributeAdvancedJunitTest.class);
+        TestSuite suite = new TestSuite();
+        suite.setName("JoinedAttributeAdvancedJunitTest");
         
-        return new TestSetup(suite) {
-            protected void setUp(){               
-                new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession());
-            }
-
-            protected void tearDown() {
-            }
-        };
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testSetup"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testProjectJoinTeamMembers"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testProjectJoinTeamLeaderJoinAddressWhereTeamLeaderNotNull"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testProjectJoinTeamMembersJoinAddress"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testProjectOuterJoinTeamMembersJoinAddress"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testProjectOuterJoinTeamMembersOuterJoinAddress"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testProjectJoinTeamMembersOuterJoinAddress"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testProblemReporterProjectJoinTeamMembersJoinAddress"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testEmployeeJoinProjects"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testEmployeeJoinProjectsOnUOW"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testEmployeeJoinProjectsJoinTeamLeaderJoinAddressWhereManagerIsNull"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testProjectOuterJoinTeamLeaderAddressTeamMembersAddressPhonesWhereProjectName"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testEmployeeOuterJoinAddressPhoneProjectsTeamLeaderAddressTeamMembersPhones"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testEmployeeOuterJoinAddressPhoneProjectsTeamLeaderAddressTeamMembersPhonesOnUOW"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testEmployeeJoinManagerAddressOuterJoinManagerAddress"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testTwoUnrelatedResultWithOneToManyJoins"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testMultipleUnrelatedResultWithOneToManyJoins"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testTwoUnrelatedResultWithOneToOneJoins"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testTwoUnrelatedResultWithOneToOneJoinsWithExtraItem"));
+        
+        return suite;
     }
     
+    /**
+     * The setup is done as a test, both to record its failure, and to allow execution in the server.
+     */
+    public void testSetup() {
+        new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession());
+        clearCache();
+    }
+    
     public void tearDown() {
         dbSessionClearCache();
         dbSession = null;
@@ -274,6 +296,7 @@
         UnitOfWork uow = acquireUnitOfWork();
         //loads objects into cache without using joins
         uow.executeQuery(controlQuery);
+        uow.commit();
         ((UnitOfWorkImpl)uow).setShouldCascadeCloneToJoinedRelationship(true);
         Collection results = (Collection)uow.executeQuery(queryWithJoins);
         getDbSession().getIdentityMapAccessor().initializeAllIdentityMaps();
@@ -282,7 +305,7 @@
         if(errorMsg.length() > 0) {
             fail(errorMsg);
         }
-    }    
+    }
     
     public void testEmployeeJoinProjectsJoinTeamLeaderJoinAddressWhereManagerIsNull() {
         ReadAllQuery query = new ReadAllQuery();
@@ -389,6 +412,7 @@
 
         UnitOfWork uow = acquireUnitOfWork();
         //loads objects into cache without using joins
+        uow.commit();
         uow.executeQuery(controlQuery);
         ((UnitOfWorkImpl)uow).setShouldCascadeCloneToJoinedRelationship(true);
         Collection results = (Collection)uow.executeQuery(queryWithJoins);
@@ -407,7 +431,6 @@
         query.setSelectionCriteria(query.getExpressionBuilder().get("lastName").equal("Way").
                                     or(query.getExpressionBuilder().get("lastName").equal("Jones")));
         
-        List list = new ArrayList();
         ReadAllQuery controlQuery = (ReadAllQuery)query.clone();
         Expression manager = query.getExpressionBuilder().get("manager");
         query.addJoinedAttribute(manager);
Index: src/org/eclipse/persistence/testing/tests/jpa/advanced/ReportQueryAdvancedJUnitTest.java
===================================================================
--- src/org/eclipse/persistence/testing/tests/jpa/advanced/ReportQueryAdvancedJUnitTest.java	(revision 2983)
+++ src/org/eclipse/persistence/testing/tests/jpa/advanced/ReportQueryAdvancedJUnitTest.java	(working copy)
@@ -97,19 +97,27 @@
     }
     
     public static Test suite() {
-        TestSuite suite = new TestSuite(ReportQueryAdvancedJUnitTest.class);
+        TestSuite suite = new TestSuite();
+        suite.setName("ReportQueryAdvancedJUnitTest");
         
-        return new TestSetup(suite) {
-            protected void setUp(){               
-                new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession());
-            }
-
-            protected void tearDown() {
-                clearCache();
-            }
-        };
+        suite.addTest(new ReportQueryAdvancedJUnitTest("testSetup"));
+        suite.addTest(new ReportQueryAdvancedJUnitTest("testPhoneCountGroupByOwner"));
+        suite.addTest(new ReportQueryAdvancedJUnitTest("testPhoneCountGroupByOwnersAddress"));
+        suite.addTest(new ReportQueryAdvancedJUnitTest("testProjectCountGroupByTeamMembers"));
+        suite.addTest(new ReportQueryAdvancedJUnitTest("testProjectCountGroupByTeamMemberAddress"));
+        suite.addTest(new ReportQueryAdvancedJUnitTest("testProjectCountGroupByTeamMemberPhone"));
+        
+        return suite;
     }
     
+    /**
+     * The setup is done as a test, both to record its failure, and to allow execution in the server.
+     */
+    public void testSetup() {
+        new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession());
+        clearCache();
+    }
+    
     public void testPhoneCountGroupByOwner() {
         ExpressionBuilder builder = new ExpressionBuilder();
         ReportQuery reportQuery = new ReportQuery(PhoneNumber.class, builder);
Index: src/org/eclipse/persistence/testing/tests/jpa/advanced/ReportQueryMultipleReturnTestSuite.java
===================================================================
--- src/org/eclipse/persistence/testing/tests/jpa/advanced/ReportQueryMultipleReturnTestSuite.java	(revision 2983)
+++ src/org/eclipse/persistence/testing/tests/jpa/advanced/ReportQueryMultipleReturnTestSuite.java	(working copy)
@@ -60,7 +60,7 @@
         ExpressionBuilder empbuilder = new ExpressionBuilder();
         reportQuery.addAttribute("salary",empbuilder.get("salary"));
         reportQuery.setSelectionCriteria(empbuilder.get("salary").greaterThan(1));
-        List result = (List)((EntityManagerImpl)createEntityManager()).getActiveSession().executeQuery(reportQuery);
+        List result = (List)getServerSession().executeQuery(reportQuery);
         Object resultItem = result.get(0);
         assertTrue("Failed to return Employees correctly, Not A Number", Number.class.isAssignableFrom(resultItem.getClass()));
         assertTrue("Failed to return Employees correctly, Not Correct Result", ((Number)resultItem).intValue() > 1);
@@ -73,7 +73,7 @@
         ExpressionBuilder empbuilder = new ExpressionBuilder();
         reportQuery.addAttribute("manager",empbuilder.get("manager"));
         reportQuery.setSelectionCriteria(empbuilder.get("salary").greaterThan(1));
-        List result = (List)((EntityManagerImpl)createEntityManager()).getActiveSession().executeQuery(reportQuery);
+        List result = (List)getServerSession().executeQuery(reportQuery);
         Object resultItem = result.get(0);
         assertTrue("Failed to return Employees correctly, Not An Employee", Employee.class.isAssignableFrom(resultItem.getClass()));
     }
@@ -86,7 +86,7 @@
         reportQuery.addAttribute("salary",empbuilder.get("salary"));
         reportQuery.addAttribute("manager",empbuilder.get("manager"));
         reportQuery.setSelectionCriteria(empbuilder.get("salary").greaterThan(1));
-        List result = (List)((EntityManagerImpl)createEntityManager()).getActiveSession().executeQuery(reportQuery);
+        List result = (List)getServerSession().executeQuery(reportQuery);
         Object innerResult = result.get(0);
         assertTrue("Failed to return Employees correctly, Not an Object Array", Object[].class.isAssignableFrom(innerResult.getClass()));
         Object resultItem = ((Object[])innerResult)[0];
@@ -106,7 +106,7 @@
         reportQuery.addAttribute("manager",empbuilder.get("manager"));
         reportQuery.addAttribute("adress.city",addBuilder.get("city"));
         reportQuery.setSelectionCriteria(empbuilder.get("salary").greaterThan(1));
-        List result = (List)((EntityManagerImpl)createEntityManager()).getActiveSession().executeQuery(reportQuery);
+        List result = (List)getServerSession().executeQuery(reportQuery);
         Object innerResult = result.get(0);
         assertTrue("Failed to return Employees correctly, Not an Object Array", Object[].class.isAssignableFrom(innerResult.getClass()));
         Object resultItem = ((Object[])innerResult)[0];
@@ -125,7 +125,7 @@
             reportQuery.setReferenceClass(Project.class);
             ExpressionBuilder empbuilder = new ExpressionBuilder();
             reportQuery.addAttribute("project",empbuilder);
-            List result = (List)((EntityManagerImpl)createEntityManager()).getActiveSession().executeQuery(reportQuery);
+            List result = (List)getServerSession().executeQuery(reportQuery);
         }catch (QueryException ex){
            return; 
         }
@@ -138,7 +138,7 @@
         reportQuery.setReferenceClass(LargeProject.class);
         ExpressionBuilder empbuilder = new ExpressionBuilder();
         reportQuery.addAttribute("project",empbuilder);
-        List result = (List)((EntityManagerImpl)createEntityManager()).getActiveSession().executeQuery(reportQuery);
+        List result = (List)getServerSession().executeQuery(reportQuery);
         Object resultItem = result.get(0);
         assertTrue("Failed to return Project as expression root correctly, Not A Project", LargeProject.class.isAssignableFrom(resultItem.getClass()));
     }
Index: src/org/eclipse/persistence/testing/tests/jpa/advanced/ServerTestSuite.java
===================================================================
--- src/org/eclipse/persistence/testing/tests/jpa/advanced/ServerTestSuite.java	(revision 2983)
+++ src/org/eclipse/persistence/testing/tests/jpa/advanced/ServerTestSuite.java	(working copy)
@@ -37,21 +37,21 @@
     public static Test suite() {
         TestSuite suite = new TestSuite();
         suite.setName("Advanced ServerTestSuite");
-
+        
         suite.addTest(NamedNativeQueryJUnitTest.suite());
         suite.addTest(CallbackEventJUnitTestSuite.suite());
-        suite.addTest(EntityManagerJUnitTestSuite.suite());
-        //suite.addTest(SQLResultSetMappingTestSuite.suite());
-        //suite.addTest(JoinedAttributeAdvancedJunitTest.suite());
-        //suite.addTest(ReportQueryMultipleReturnTestSuite.suite());
-        //suite.addTest(ReportQueryAdvancedJUnitTest.suite());
+        //suite.addTest(EntityManagerJUnitTestSuite.suite()); - run separately since not all EM didn't close
+        //suite.addTest(SQLResultSetMappingTestSuite.suite()); - hangup for J2SE
+        suite.addTest(JoinedAttributeAdvancedJunitTest.suite());
+        suite.addTest(ReportQueryMultipleReturnTestSuite.suite());
+        suite.addTest(ReportQueryAdvancedJUnitTest.suite());
         suite.addTest(ExtendedPersistenceContextJUnitTestSuite.suite());
         suite.addTest(ReportQueryConstructorExpressionTestSuite.suite());
         suite.addTest(OptimisticConcurrencyJUnitTestSuite.suite());
         suite.addTest(AdvancedJPAJunitTest.suite());
         suite.addTest(AdvancedJunitTest.suite());
         suite.addTest(AdvancedCompositePKJunitTest.suite());
-        
+
         return suite;
     }
 }
Index: src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/AdvancedJPAJunitTest.java
===================================================================
--- src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/AdvancedJPAJunitTest.java	(revision 2970)
+++ src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/AdvancedJPAJunitTest.java	(working copy)
@@ -14,6 +14,7 @@
 
 import java.util.Collection;
 
+import javax.persistence.Query;
 import javax.persistence.EntityManager;
 
 import junit.framework.*;
@@ -66,6 +67,7 @@
     public static Test suite() {
         TestSuite suite = new TestSuite();
         suite.setName("AdvancedJPAJunitTest (fieldaccess)");
+        suite.addTest(new AdvancedJPAJunitTest("testSetup"));
         
         suite.addTest(new AdvancedJPAJunitTest("testJoinFetchAnnotation"));
         suite.addTest(new AdvancedJPAJunitTest("testVerifyEmployeeCustomizerSettings"));
@@ -93,33 +95,33 @@
         // Temporary removal of JPA 2.0 dependency
         //suite.addTest(new AdvancedJPAJunitTest("testPessimisticLockingNamedQuery"));
 
-        return new TestSetup(suite) {
-            protected void setUp() { 
-                ServerSession session = JUnitTestCase.getServerSession("fieldaccess");
-                new AdvancedTableCreator().replaceTables(session);
-                
-                // The EquipmentCode class 'should' be set to read only. We want 
-                // to be able to create a couple in the Employee populator, so 
-                // force the read only to false. If EquipmentCode is not 
-                // actually read only, don't worry, we set the original read
-                // only value back on the descriptor and the error will be 
-                // caught in a later test in this suite.
-                ClassDescriptor descriptor = session.getDescriptor(EquipmentCode.class);
-                boolean shouldBeReadOnly = descriptor.shouldBeReadOnly();
-                descriptor.setShouldBeReadOnly(false);
-                
-                // Populate the database with our examples.
-                EmployeePopulator employeePopulator = new EmployeePopulator();         
-                employeePopulator.buildExamples();
-                employeePopulator.persistExample(session);
-                
-                descriptor.setShouldBeReadOnly(shouldBeReadOnly);
-            }
+        return suite;
+    }
+    
+    /**
+     * The setup is done as a test, both to record its failure, and to allow execution in the server.
+     */
+    public void testSetup() {
+        ServerSession session = JUnitTestCase.getServerSession("fieldaccess");
+        new AdvancedTableCreator().replaceTables(session);
+        // The EquipmentCode class 'should' be set to read only. We want 
+        // to be able to create a couple in the Employee populator, so 
+         // force the read only to false. If EquipmentCode is not 
+        // actually read only, don't worry, we set the original read
+        // only value back on the descriptor and the error will be 
+        // caught in a later test in this suite.
+        ClassDescriptor descriptor = session.getDescriptor(EquipmentCode.class);
+        boolean shouldBeReadOnly = descriptor.shouldBeReadOnly();
+        descriptor.setShouldBeReadOnly(false);
+        
+        // Populate the database with our examples.
+        EmployeePopulator employeePopulator = new EmployeePopulator();         
+        employeePopulator.buildExamples();
+        employeePopulator.persistExample(session);
+        
+        descriptor.setShouldBeReadOnly(shouldBeReadOnly);
 
-            protected void tearDown() {
-                clearCache("fieldaccess");
-            }
-        };
+        clearCache("fieldaccess");
     }
     
     /**
@@ -128,7 +130,7 @@
     public void testVerifyEmployeeCustomizerSettings() {
         EntityManager em = createEntityManager("fieldaccess");
         
-        ClassDescriptor descriptor = ((EntityManagerImpl) em).getServerSession().getDescriptorForAlias("Employee");
+        ClassDescriptor descriptor = getServerSession("fieldaccess").getDescriptorForAlias("Employee");
             
         if (descriptor == null) {
             fail("A descriptor for the Employee alias was not found.");    
@@ -207,7 +209,7 @@
                     break;
                 }
             }
-            
+            commitTransaction(em);
             assertTrue("The new responsibility was not added.", found);
             assertTrue("The basic collection using enums was not persisted correctly.", emp.worksMondayToFriday());
         } catch (RuntimeException e) {
@@ -282,7 +284,7 @@
             assertTrue("Diners Club card did not persist correctly.", buyer.hasDinersClub(diners));
             assertTrue("Mastercard card did not persist correctly.", buyer.hasMastercard(mastercard));
             assertTrue("The serialized enum set was not persisted correctly.", buyer.buysSaturdayToSunday());
-            
+            commitTransaction(em);
         } catch (RuntimeException e) {
             if (isTransactionActive(em)){
                 rollbackTransaction(em);
@@ -300,6 +302,11 @@
      * Tests an OptimisticLocking policy set on Buyer.
      */
     public void testBuyerOptimisticLocking() {
+        // Cannot create parallel entity managers in the server.
+        if (isOnServer()) {
+            return;
+        }
+
         EntityManager em1 = createEntityManager("fieldaccess");
         EntityManager em2 = createEntityManager("fieldaccess");
         em1.getTransaction().begin();
@@ -573,7 +580,7 @@
             commitTransaction(em);
             
             Address address2 = (Address) em.createNamedQuery("SProcAddress").setParameter("ADDRESS_ID", address1.getId()).getSingleResult();
-            assertTrue("Address not found using stored procedure", address2.equals(address1));
+            assertTrue("Address not found using stored procedure", (address2.getId() == address1.getId()));
             
         } catch (RuntimeException e) {
             if (isTransactionActive(em)){
@@ -716,7 +723,7 @@
         beginTransaction(em);
         
         try {    
-            EJBQueryImpl query = (EJBQueryImpl) em.createNamedQuery("findSQLEquipmentCodeA");
+            Query query = em.createNamedQuery("findSQLEquipmentCodeA");
             EquipmentCode equipmentCode = (EquipmentCode) query.getSingleResult();
             
             equipmentCode.setCode("Z");
@@ -726,6 +733,7 @@
             // EquipmentCode A again. If an exception is caught, then it was 
             // not found, therefore, updated on the db.
             try {
+                query = em.createNamedQuery("findSQLEquipmentCodeA");
                 query.getSingleResult();
             } catch (Exception e) {
                 fail("The read only EquipmentA was modified");
@@ -752,7 +760,7 @@
      */
     /* // KERNEL_SRG_TEMP       
     public void testPessimisticLockingNamedQuery() {
-        ServerSession session = JUnitTestCase.getServerSession();
+        ServerSession session = JUnitTestCase.getServerSession("fieldaccess");
         
         // Cannot create parallel entity managers in the server.
         if (! isOnServer() && ! session.getPlatform().isMySQL() && ! session.getPlatform().isTimesTen()) {
Index: src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/AdvancedJunitTest.java
===================================================================
--- src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/AdvancedJunitTest.java	(revision 2970)
+++ src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/AdvancedJunitTest.java	(working copy)
@@ -50,17 +50,26 @@
     }
     
     public static Test suite() {
-        TestSuite suite = new TestSuite(AdvancedJunitTest.class);
+        TestSuite suite = new TestSuite("AdvancedJunitTest");
 
-        return new TestSetup(suite) {
-            protected void setUp() { 
-                new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("fieldaccess"));
-            }
+        suite.addTest(new AdvancedJunitTest("testSetup"));
+        suite.addTest(new AdvancedJunitTest("testGF1818"));
+        suite.addTest(new AdvancedJunitTest("testGF1894"));
+        suite.addTest(new AdvancedJunitTest("testGF894"));
+        suite.addTest(new AdvancedJunitTest("testManAndWoman"));
+        suite.addTest(new AdvancedJunitTest("testStringArrayField"));
+        suite.addTest(new AdvancedJunitTest("testBUG241388"));
+        
+        return suite;
+    }
+    
+    /**
+     * The setup is done as a test, both to record its failure, and to allow execution in the server.
+     */
+    public void testSetup() {
+        new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("fieldaccess"));
 
-            protected void tearDown() {
-                clearCache("fieldaccess");
-            }
-        };
+        clearCache("fieldaccess");
     }
 
     public void testGF1818() {
@@ -206,7 +215,7 @@
         Vegetable vegetable;
         try {
             vegetable = em.find(Vegetable.class, pk);
-            
+            commitTransaction(em);
             assertNotNull(vegetable);
             assertTrue(Arrays.equals(tags, vegetable.getTags()));
             
Index: src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/CallbackEventJUnitTestSuite.java
===================================================================
--- src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/CallbackEventJUnitTestSuite.java	(revision 2970)
+++ src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/CallbackEventJUnitTestSuite.java	(working copy)
@@ -41,23 +41,29 @@
         super(name);
     }
 
-	public static Test suite() {
-        TestSuite suite = new TestSuite(CallbackEventJUnitTestSuite.class);
+    public static Test suite() {
+        TestSuite suite = new TestSuite();
+        suite.setName("CallbackEventJUnitTestSuite");
         
-        suite.setName("CallbackEventJUnitTestSuite (fieldaccess)");
+        suite.addTest(new CallbackEventJUnitTestSuite("testSetup"));
+        suite.addTest(new CallbackEventJUnitTestSuite("testPersistThenRemoveCalls"));
+        suite.addTest(new CallbackEventJUnitTestSuite("testRemoveUnmanagedNewEntity"));
+        suite.addTest(new CallbackEventJUnitTestSuite("testPersistOnRegisteredObject"));
+        suite.addTest(new CallbackEventJUnitTestSuite("testPreUpdateEvent_UpdateAltered"));
+        suite.addTest(new CallbackEventJUnitTestSuite("testPreUpdateEvent_UpdateReverted"));
         
-        return new TestSetup(suite) {
+        return suite;
+    }
+    
+    /**
+     * The setup is done as a test, both to record its failure, and to allow execution in the server.
+     */
+    public void testSetup() {
+        new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("fieldaccess"));
         
-            protected void setUp(){      
-                new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("fieldaccess"));
-            }
-
-            protected void tearDown() {
-                clearCache("fieldaccess");
-            }
-        };
+        clearCache("fieldaccess");
     }
- 
+    
     public void setUp () {
         m_reset = true;
         super.setUp();
@@ -248,27 +254,6 @@
         Vector pk = new Vector();
         pk.add(emp.getId());
         return ((Integer)getServerSession("fieldaccess").getDescriptor(Employee.class).getOptimisticLockingPolicy().getWriteLockValue(emp, pk, getServerSession("fieldaccess"))).intValue();
-    }    
-    
-    public void tearDown () {
-        if (m_reset) {
-            EntityManager em = createEntityManager("fieldaccess");
-            beginTransaction(em);
-            try {
-                Employee emp = em.find(Employee.class, new_emp.getId());
-                em.remove(emp);
-                commitTransaction(em);
-            } catch (RuntimeException ex){
-                if (isTransactionActive(em)){
-                    rollbackTransaction(em);
-                }
-                closeEntityManager(em);
-                throw ex;
-            }
-            m_reset = false;
-        }
-        super.tearDown();
     }
     
-
 }
Index: src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/ExtendedPersistenceContextJUnitTestSuite.java
===================================================================
--- src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/ExtendedPersistenceContextJUnitTestSuite.java	(revision 2970)
+++ src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/ExtendedPersistenceContextJUnitTestSuite.java	(working copy)
@@ -39,28 +39,30 @@
     public static Test suite() {
         TestSuite suite = new TestSuite();
         suite.setName("ExtendedPersistenceContextJUnitTestSuite (fieldaccess)");
+        
+        suite.addTest(new ExtendedPersistenceContextJUnitTestSuite("testSetup"));
         suite.addTest(new ExtendedPersistenceContextJUnitTestSuite("testExtendedPersistenceContext"));
 
-        return new TestSetup(suite) {
+        return suite;
+    }
+    
+    /**
+     * The setup is done as a test, both to record its failure, and to allow execution in the server.
+     */
+    public void testSetup() {
+        new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("fieldaccess"));
+        //create a new EmployeePopulator
+        EmployeePopulator employeePopulator = new EmployeePopulator();
         
-            protected void setUp(){               
-                new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("fieldaccess"));
-                //create a new EmployeePopulator
-                EmployeePopulator employeePopulator = new EmployeePopulator();         
-                
-                //Populate the tables
-                employeePopulator.buildExamples();
-                
-                //Persist the examples in the database
-                employeePopulator.persistExample(JUnitTestCase.getServerSession("fieldaccess"));     
-            }
+        //Populate the tables
+        employeePopulator.buildExamples();
+        
+        //Persist the examples in the database
+        employeePopulator.persistExample(JUnitTestCase.getServerSession("fieldaccess"));
 
-            protected void tearDown() {
-                clearCache("fieldaccess");
-            }
-        };
+        clearCache("fieldaccess");
     }
-   
+    
     // JUnit framework will automatically execute all methods starting with test...    
     public void testExtendedPersistenceContext() {
         EntityManager em = createEntityManager("fieldaccess");
@@ -72,7 +74,11 @@
         }
         Object obj = result.get(0);
         commitTransaction(em);
-        assertTrue("Extended PersistenceContext did not continue to maintain object after commit.", em.contains(obj));
+        if (isOnServer()) {
+            assertFalse("Extended PersistenceContext did not continue to maintain object after commit.", em.contains(obj));
+        } else {
+            assertTrue("Extended PersistenceContext did not continue to maintain object after commit.", em.contains(obj));
+        }
         closeEntityManager(em);
     }
 }
Index: src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/JoinedAttributeAdvancedJunitTest.java
===================================================================
--- src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/JoinedAttributeAdvancedJunitTest.java	(revision 2970)
+++ src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/JoinedAttributeAdvancedJunitTest.java	(working copy)
@@ -15,6 +15,7 @@
 package org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Vector;
@@ -112,270 +113,44 @@
     }
     
     public static Test suite() {
-        TestSuite suite = new TestSuite(JoinedAttributeAdvancedJunitTest.class);
+        TestSuite suite = new TestSuite();
+        suite.setName("JoinedAttributeAdvancedJunitTest (fieldaccess)");
         
-        return new TestSetup(suite) {
-            protected void setUp(){               
-                new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("fieldaccess"));
-            }
-
-            protected void tearDown() {
-            }
-        };
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testSetup"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testProjectJoinTeamMembers"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testProjectJoinTeamLeaderJoinAddressWhereTeamLeaderNotNull"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testProjectJoinTeamMembersJoinAddress"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testProjectOuterJoinTeamMembersJoinAddress"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testProjectOuterJoinTeamMembersOuterJoinAddress"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testProjectJoinTeamMembersOuterJoinAddress"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testProblemReporterProjectJoinTeamMembersJoinAddress"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testEmployeeJoinProjects"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testEmployeeJoinProjectsJoinTeamLeaderJoinAddressWhereManagerIsNull"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testProjectOuterJoinTeamLeaderAddressTeamMembersAddressPhonesWhereProjectName"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testEmployeeOuterJoinAddressPhoneProjectsTeamLeaderAddressTeamMembersPhones"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testEmployeeJoinManagerAddressOuterJoinManagerAddress"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testTwoUnrelatedResultWithOneToManyJoins"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testMultipleUnrelatedResultWithOneToManyJoins"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testTwoUnrelatedResultWithOneToOneJoins"));
+        suite.addTest(new JoinedAttributeAdvancedJunitTest("testTwoUnrelatedResultWithOneToOneJoinsWithExtraItem"));
+        
+        return suite;
     }
     
+    /**
+     * The setup is done as a test, both to record its failure, and to allow execution in the server.
+     */
+    public void testSetup() {
+        new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("fieldaccess"));
+        clearCache("fieldaccess");
+    }
+    
     public void tearDown() {
         dbSessionClearCache();
         dbSession = null;
         super.tearDown();
     }
         
-/*    public void testProjectJoinTeamMembers() {
-        ReportQuery query = new ReportQuery();
-        query.setShouldReturnWithoutReportQueryResult(true);
-        query.setReferenceClass(Project.class);
-        
-        ReportQuery controlQuery = (ReportQuery)query.clone();
-        ArrayList joins = new ArrayList();
-        joins.add(query.getExpressionBuilder().anyOf("teamMembers"));
-        
-        query.addItem("project", query.getExpressionBuilder(), joins);
-
-        String errorMsg = executeQueriesAndCompareResults(controlQuery, query);
-        if(errorMsg.length() > 0) {
-            fail(errorMsg);
-        }
-    }
-    
-    public void testProjectJoinTeamLeaderJoinAddressWhereTeamLeaderNotNull() {
-        ReportQuery query = new ReportQuery();
-        query.setShouldReturnWithoutReportQueryResult(true);
-        query.setReferenceClass(Project.class);
-        Expression teamLeader = query.getExpressionBuilder().get("teamLeader");
-        query.setSelectionCriteria(teamLeader.notNull());
-        
-        ReportQuery controlQuery = (ReportQuery)query.clone();
-        ArrayList joins = new ArrayList();
-        joins.add(teamLeader);
-        Expression teamLeaderAddress = teamLeader.get("address");
-        joins.add(teamLeaderAddress);
-        
-        query.addItem("project", query.getExpressionBuilder(), joins);
-
-        String errorMsg = executeQueriesAndCompareResults(controlQuery, query);
-        if(errorMsg.length() > 0) {
-            fail(errorMsg);
-        }
-    }
-    
-    public void testProjectJoinTeamMembersJoinAddress() {
-        ReportQuery query = new ReportQuery();
-        query.setShouldReturnWithoutReportQueryResult(true);
-        query.setReferenceClass(Project.class);
-        
-        ReportQuery controlQuery = (ReportQuery)query.clone();
-        
-        ArrayList joins = new ArrayList();
-        Expression teamMembers = query.getExpressionBuilder().anyOf("teamMembers");
-        joins.add(teamMembers);
-        Expression teamMembersAddress = teamMembers.get("address");
-        joins.add(teamMembersAddress);
-        
-        query.addItem("proejct", query.getExpressionBuilder(), joins);
-
-        String errorMsg = executeQueriesAndCompareResults(controlQuery, query);
-        if(errorMsg.length() > 0) {
-            fail(errorMsg);
-        }
-    }
-    
-    public void testProjectOuterJoinTeamMembersJoinAddress() {
-        ReportQuery query = new ReportQuery();
-        query.setShouldReturnWithoutReportQueryResult(true);
-        query.setReferenceClass(Project.class);
-        
-        ReportQuery controlQuery = (ReportQuery)query.clone();
-        
-        ArrayList joins = new ArrayList();
-        Expression teamMembers = query.getExpressionBuilder().anyOfAllowingNone("teamMembers");
-        joins.add(teamMembers);
-        Expression teamMembersAddress = teamMembers.get("address");
-        joins.add(teamMembersAddress);
-        
-        query.addItem("project", query.getExpressionBuilder(), joins);
-
-        String errorMsg = executeQueriesAndCompareResults(controlQuery, query);
-        if(errorMsg.length() > 0) {
-            fail(errorMsg);
-        }
-    }
-    
-    public void testProjectOuterJoinTeamMembersOuterJoinAddress() {
-        ReportQuery query = new ReportQuery();
-        query.setShouldReturnWithoutReportQueryResult(true);
-        query.setReferenceClass(Project.class);
-        
-        ReportQuery controlQuery = (ReportQuery)query.clone();
-        
-        ArrayList joins = new ArrayList();
-        Expression teamMembers = query.getExpressionBuilder().anyOfAllowingNone("teamMembers");
-        joins.add(teamMembers);
-        Expression teamMembersAddress = teamMembers.getAllowingNull("address");
-        joins.add(teamMembersAddress);
-        
-        query.addItem("project", query.getExpressionBuilder(), joins);
-
-        String errorMsg = executeQueriesAndCompareResults(controlQuery, query);
-        if(errorMsg.length() > 0) {
-            fail(errorMsg);
-        }
-    }
-    
-    public void testProjectJoinTeamMembersOuterJoinAddress() {
-        ReportQuery query = new ReportQuery();
-        query.setShouldReturnWithoutReportQueryResult(true);
-        query.setReferenceClass(Project.class);
-        
-        ReportQuery controlQuery = (ReportQuery)query.clone();
-        
-        ArrayList joins = new ArrayList();
-        Expression teamMembers = query.getExpressionBuilder().anyOf("teamMembers");
-        joins.add(teamMembers);
-        Expression teamMembersAddress = teamMembers.getAllowingNull("address");
-        joins.add(teamMembersAddress);
-        
-        query.addItem("project", query.getExpressionBuilder(), joins);
-
-        String errorMsg = executeQueriesAndCompareResults(controlQuery, query);
-        if(errorMsg.length() > 0) {
-            fail(errorMsg);
-        }
-    }
-    
-    public void testProblemReporterProjectJoinTeamMembersJoinAddress() {
-        ReportQuery query = new ReportQuery();
-        query.setShouldReturnWithoutReportQueryResult(true);
-        query.setReferenceClass(Project.class);
-        query.setSelectionCriteria(query.getExpressionBuilder().get("name").equal("Problem Reporter"));
-        
-        ReportQuery controlQuery = (ReportQuery)query.clone();
-        
-        ArrayList joins = new ArrayList();
-        Expression teamMembers = query.getExpressionBuilder().anyOf("teamMembers");
-        joins.add(teamMembers);
-        Expression teamMembersAddress = teamMembers.get("address");
-        joins.add(teamMembersAddress);
-        
-        query.addItem("project", query.getExpressionBuilder(), joins);
-
-        String errorMsg = executeQueriesAndCompareResults(controlQuery, query);
-        if(errorMsg.length() > 0) {
-            fail(errorMsg);
-        }
-    }
-    
-    public void testEmployeeJoinProjects() {
-        ReportQuery query = new ReportQuery();
-        query.setShouldReturnWithoutReportQueryResult(true);
-        query.setReferenceClass(Employee.class);
-        
-        ReportQuery controlQuery = (ReportQuery)query.clone();
-        ArrayList list = new ArrayList();
-        list.add(query.getExpressionBuilder().anyOf("projects"));
-
-        query.addItem("employee", query.getExpressionBuilder(), list);
-        String errorMsg = executeQueriesAndCompareResults(controlQuery, query);
-        if(errorMsg.length() > 0) {
-            fail(errorMsg);
-        }
-    }
-    
-    public void testEmployeeJoinProjectsJoinTeamLeaderJoinAddressWhereManagerIsNull() {
-        ReportQuery query = new ReportQuery();
-        query.setShouldReturnWithoutReportQueryResult(true);
-        query.setReferenceClass(Employee.class);
-        query.setSelectionCriteria(query.getExpressionBuilder().get("manager").isNull());
-        
-        ReportQuery controlQuery = (ReportQuery)query.clone();
-        ArrayList joins = new ArrayList();
-        Expression projects = query.getExpressionBuilder().anyOf("projects");
-        joins.add(projects);
-        Expression teamLeader = projects.get("teamLeader");
-        joins.add(teamLeader);
-        Expression teamLeaderAddress = teamLeader.get("address");
-        joins.add(teamLeaderAddress);
-        query.addItem("employee", query.getExpressionBuilder(), joins);
-        
-        String errorMsg = executeQueriesAndCompareResults(controlQuery, query);
-        if(errorMsg.length() > 0) {
-            fail(errorMsg);
-        }
-    }
-    
-    public void testProjectOuterJoinTeamLeaderAddressTeamMembersAddressPhonesWhereProjectName() {
-        ReportQuery query = new ReportQuery();
-        query.setShouldReturnWithoutReportQueryResult(true);
-        query.setReferenceClass(Project.class);
-        query.setSelectionCriteria(query.getExpressionBuilder().get("name").equal("Problem Reporting System").
-            or(query.getExpressionBuilder().get("name").equal("Bleep Blob")));
-        
-        ReportQuery controlQuery = (ReportQuery)query.clone();
-        
-        ArrayList joins = new ArrayList();
-        Expression teamLeader = query.getExpressionBuilder().getAllowingNull("teamLeader");
-        joins.add(teamLeader);
-        Expression teamLeaderAddress = teamLeader.getAllowingNull("address");
-        joins.add(teamLeaderAddress);
-        Expression teamMembers = query.getExpressionBuilder().anyOfAllowingNone("teamMembers");
-        joins.add(teamMembers);
-        Expression teamMembersAddress = teamMembers.getAllowingNull("address");
-        joins.add(teamMembersAddress);
-        Expression teamMembersPhones = teamMembers.anyOfAllowingNone("phoneNumbers");
-        joins.add(teamMembersPhones);
-        query.addItem("project", query.getExpressionBuilder(), joins);
-
-        String errorMsg = executeQueriesAndCompareResults(controlQuery, query);
-        if(errorMsg.length() > 0) {
-            fail(errorMsg);
-        }
-    }
-    
-    public void testEmployeeOuterJoinAddressPhoneProjectsTeamLeaderAddressTeamMembersPhones() {
-        ReportQuery query = new ReportQuery();
-        query.setShouldReturnWithoutReportQueryResult(true);
-        query.setReferenceClass(Employee.class);
-        
-        ReportQuery controlQuery = (ReportQuery)query.clone();
-        
-        // Note that without the following two lines address and phones are not read not for all Employees:
-        // once an Employee is built (without Address and Phones)
-        // it's not going to be rebuilt (get Address and Phones) when it's
-        // up again either as a teamLeader or teamMember.
-        // That means that only Employees read first indirectly (either as teamLeaders or
-        // teamMembers would've got Phones and Addresses).
-        ArrayList joins = new ArrayList();
-        joins.add(query.getExpressionBuilder().getAllowingNull("address"));
-        joins.add(query.getExpressionBuilder().anyOfAllowingNone("phoneNumbers"));
-        
-        Expression projects = query.getExpressionBuilder().anyOfAllowingNone("projects");
-        joins.add(projects);
-        Expression teamLeader = projects.getAllowingNull("teamLeader");
-        joins.add(teamLeader);
-        Expression teamLeaderAddress = teamLeader.getAllowingNull("address");
-        joins.add(teamLeaderAddress);
-        Expression teamMembers = projects.anyOfAllowingNone("teamMembers");
-        joins.add(teamMembers);
-        Expression teamMembersPhones = teamMembers.anyOfAllowingNone("phoneNumbers");
-        joins.add(teamMembersPhones);
-        query.addItem("employee", query.getExpressionBuilder(), joins);
-
-        String errorMsg = executeQueriesAndCompareResults(controlQuery, query);
-        if(errorMsg.length() > 0) {
-            fail(errorMsg);
-        }
-    }
-    
-*/
     public void testProjectJoinTeamMembers() {
         ReadAllQuery query = new ReadAllQuery();
         query.setReferenceClass(Project.class);
Index: src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/NamedNativeQueryJUnitTest.java
===================================================================
--- src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/NamedNativeQueryJUnitTest.java	(revision 2970)
+++ src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/NamedNativeQueryJUnitTest.java	(working copy)
@@ -32,22 +32,20 @@
     public static Test suite() {
         TestSuite suite = new TestSuite();
         suite.setName("NamedNativeQueryJUnitTest (fieldaccess)");
+        suite.addTest(new NamedNativeQueryJUnitTest("testSetup"));
         suite.addTest(new NamedNativeQueryJUnitTest("testNamedNativeQuery"));
         
-        return new TestSetup(suite) {
-        
-            protected void setUp(){               
-                DatabaseSession session = JUnitTestCase.getServerSession("fieldaccess");
-                
-                new AdvancedTableCreator().replaceTables(session);
-            }
-
-            protected void tearDown() {
-                clearCache("fieldaccess");
-            }
-        };
+        return suite;
     }
     
+    /**
+     * The setup is done as a test, both to record its failure, and to allow execution in the server.
+     */
+    public void testSetup() {
+        new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("fieldaccess"));
+        clearCache("fieldaccess");
+    }
+    
     public void testNamedNativeQuery() {
         Exception exception = null;
         
Index: src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/OptimisticConcurrencyJUnitTestSuite.java
===================================================================
--- src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/OptimisticConcurrencyJUnitTestSuite.java	(revision 2970)
+++ src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/OptimisticConcurrencyJUnitTestSuite.java	(working copy)
@@ -49,26 +49,25 @@
 
     public static Test suite() {
         TestSuite suite = new TestSuite("Optimistic Concurrency (fieldaccess)");
+        suite.addTest(new OptimisticConcurrencyJUnitTestSuite("testSetup"));
         suite.addTest(new OptimisticConcurrencyJUnitTestSuite("testCreateProjects"));
         suite.addTest(new OptimisticConcurrencyJUnitTestSuite("testCreateEmployeeWithFlush"));
         suite.addTest(new OptimisticConcurrencyJUnitTestSuite("testVersionUpdateWithCorrectValue"));
         suite.addTest(new OptimisticConcurrencyJUnitTestSuite("testVersionUpdateWithIncorrectValue"));
         suite.addTest(new OptimisticConcurrencyJUnitTestSuite("testVersionUpdateWithNullValue"));
-
-        return new TestSetup(suite) {
-
-            protected void setUp(){
-                DatabaseSession session = JUnitTestCase.getServerSession("fieldaccess");
-                new AdvancedTableCreator().replaceTables(session);
-            }
-
-            protected void tearDown() {
-                clearCache("fieldaccess");
-            }
-        };
+        
+        return suite;
     }
-
+    
     /**
+     * The setup is done as a test, both to record its failure, and to allow execution in the server.
+     */
+    public void testSetup() {
+        new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("fieldaccess"));
+        clearCache("fieldaccess");
+    }
+    
+    /**
      * Creates two projects used in later tests.
      */
     public void testCreateProjects() {
@@ -166,7 +165,8 @@
             commitTransaction(em);
 
             beginTransaction(em);
-            employee.setVersion(2);
+            Employee employee1 = em.find(Employee.class, employee.getId());
+            employee1.setVersion(2);
             commitTransaction(em);
             fail("updating object version with wrong value didn't throw exception");
         } catch (PersistenceException pe) {
@@ -196,13 +196,14 @@
             commitTransaction(em);
 
             beginTransaction(em);
-            employee.setVersion(null);
+            Employee employee2 = em.find(Employee.class, employee.getId());
+            employee2.setVersion(null);
             commitTransaction(em);
-            fail("employee.setVersion(null) didn't throw exception");
+            fail("employee2.setVersion(null) didn't throw exception");
         } catch (PersistenceException pe) {
             // expected behavior
         } catch (Exception e) {
-            fail("employee.setVersion(null) threw a wrong exception: " + e.getMessage());
+            fail("employee2.setVersion(null) threw a wrong exception: " + e.getMessage());
         } finally {
             if (isTransactionActive(em)){
                 rollbackTransaction(em);
Index: src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/ReportQueryAdvancedJUnitTest.java
===================================================================
--- src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/ReportQueryAdvancedJUnitTest.java	(revision 2970)
+++ src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/ReportQueryAdvancedJUnitTest.java	(working copy)
@@ -97,19 +97,27 @@
     }
     
     public static Test suite() {
-        TestSuite suite = new TestSuite(ReportQueryAdvancedJUnitTest.class);
+        TestSuite suite = new TestSuite();
+        suite.setName("ReportQueryAdvancedJUnitTest (fieldaccess)");
         
-        return new TestSetup(suite) {
-            protected void setUp(){               
-                new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession());
-            }
-
-            protected void tearDown() {
-                clearCache("fieldaccess");
-            }
-        };
+        suite.addTest(new ReportQueryAdvancedJUnitTest("testSetup"));
+        suite.addTest(new ReportQueryAdvancedJUnitTest("testPhoneCountGroupByOwner"));
+        suite.addTest(new ReportQueryAdvancedJUnitTest("testPhoneCountGroupByOwnersAddress"));
+        suite.addTest(new ReportQueryAdvancedJUnitTest("testProjectCountGroupByTeamMembers"));
+        suite.addTest(new ReportQueryAdvancedJUnitTest("testProjectCountGroupByTeamMemberAddress"));
+        suite.addTest(new ReportQueryAdvancedJUnitTest("testProjectCountGroupByTeamMemberPhone"));
+        
+        return suite;
     }
     
+    /**
+     * The setup is done as a test, both to record its failure, and to allow execution in the server.
+     */
+    public void testSetup() {
+        new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("fieldaccess"));
+        clearCache("fieldaccess");
+    }
+    
     public void testPhoneCountGroupByOwner() {
         ExpressionBuilder builder = new ExpressionBuilder();
         ReportQuery reportQuery = new ReportQuery(PhoneNumber.class, builder);
Index: src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/ReportQueryConstructorExpressionTestSuite.java
===================================================================
--- src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/ReportQueryConstructorExpressionTestSuite.java	(revision 2970)
+++ src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/ReportQueryConstructorExpressionTestSuite.java	(working copy)
@@ -30,6 +30,8 @@
 import junit.framework.Test;
 import junit.extensions.TestSetup;
 
+import javax.persistence.EntityManager;
+
 import java.util.Vector;
 import java.util.Iterator;
 
@@ -58,32 +60,36 @@
     }
     
     public static Test suite() {    
-        TestSuite suite = new TestSuite(ReportQueryConstructorExpressionTestSuite.class);
-        suite.setName("ReportQueryConstructorExpressionTestSuite (fieldaccess)");      
-
-        return new TestSetup(suite) {
+        TestSuite suite = new TestSuite();
+        suite.setName("ReportQueryConstructorExpressionTestSuite (fieldaccess)");
         
-            protected void setUp(){
-                           
-                //get session to start setup
-                DatabaseSession session = JUnitTestCase.getServerSession("fieldaccess");
-                
-                //create a new EmployeePopulator
-                EmployeePopulator employeePopulator = new EmployeePopulator();
-                
-                new AdvancedTableCreator().replaceTables(session);
-           
-                //Populate the tables
-                employeePopulator.buildExamples();
-                
-                //Persist the examples in the database
-                employeePopulator.persistExample(session);       
-            }
+        suite.addTest(new ReportQueryConstructorExpressionTestSuite("testSetup"));
+        suite.addTest(new ReportQueryConstructorExpressionTestSuite("testSimpleConstructorExpression"));
+        suite.addTest(new ReportQueryConstructorExpressionTestSuite("testSimpleConstructorExpressionWithNamedQuery"));
+        suite.addTest(new ReportQueryConstructorExpressionTestSuite("testMultipleTypeConstructorExpression"));
+        suite.addTest(new ReportQueryConstructorExpressionTestSuite("testNonExistantConstructorConstructorExpression"));
+        suite.addTest(new ReportQueryConstructorExpressionTestSuite("testPrimitiveConstructorExpression"));
+        suite.addTest(new ReportQueryConstructorExpressionTestSuite("testConstructorEJBQLWithInheritance"));
+        suite.addTest(new ReportQueryConstructorExpressionTestSuite("testConstructorExpressionWithOtherAttributes"));
+        
+        return suite;
+    }
+    
+    /**
+     * The setup is done as a test, both to record its failure, and to allow execution in the server.
+     */
+    public void testSetup() {
+        new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("fieldaccess"));
+        //create a new EmployeePopulator
+        EmployeePopulator employeePopulator = new EmployeePopulator();
+        
+        //Populate the tables
+        employeePopulator.buildExamples();
+        
+        //Persist the examples in the database
+        employeePopulator.persistExample(JUnitTestCase.getServerSession("fieldaccess"));
 
-            protected void tearDown() {
-                clearCache("fieldaccess");
-            }
-        };
+        clearCache("fieldaccess");
     }
     
     public void testSimpleConstructorExpression(){
@@ -91,9 +97,9 @@
         ReportQuery query = new ReportQuery(Employee.class, employees);
         query.addAttribute("firstName");
         query.addAttribute("lastName");
-        org.eclipse.persistence.jpa.JpaEntityManager em = (org.eclipse.persistence.jpa.JpaEntityManager) createEntityManager("fieldaccess");          
+        EntityManager em = createEntityManager("fieldaccess");          
 
-        Vector reportResults = (Vector)em.getActiveSession().executeQuery(query);
+        Vector reportResults = (Vector)getServerSession("fieldaccess").executeQuery(query);
         
         employees = new ExpressionBuilder();
         query = new ReportQuery(Employee.class, employees);
@@ -103,7 +109,7 @@
         query.addAttribute("firstName");
         query.addAttribute("lastName");
         query.endAddingToConstructorItem();
-        Vector results = (Vector)em.getActiveSession().executeQuery(query);
+        Vector results = (Vector)getServerSession("fieldaccess").executeQuery(query);
         Iterator i = results.iterator();
         Iterator report = reportResults.iterator();
         while (i.hasNext()){
@@ -127,9 +133,9 @@
         ReportQuery query = new ReportQuery(Employee.class, employees);
         query.addAttribute("firstName");
         query.addAttribute("lastName");
-        org.eclipse.persistence.jpa.JpaEntityManager em = (org.eclipse.persistence.jpa.JpaEntityManager) createEntityManager("fieldaccess");          
+        EntityManager em = createEntityManager("fieldaccess");          
 
-        Vector reportResults = (Vector)em.getActiveSession().executeQuery(query);
+        Vector reportResults = (Vector)getServerSession("fieldaccess").executeQuery(query);
 
         Vector results = (Vector)em.createNamedQuery("constuctFieldAccessEmployees").getResultList();
         Iterator i = results.iterator();
@@ -157,9 +163,9 @@
         query.addItem("endDate", employees.get("period").get("endDate"));
         query.addAttribute("id");
 
-        org.eclipse.persistence.jpa.JpaEntityManager em = (org.eclipse.persistence.jpa.JpaEntityManager) createEntityManager("fieldaccess");          
+        EntityManager em = createEntityManager("fieldaccess");          
 
-        Vector reportResults = (Vector)em.getActiveSession().executeQuery(query);
+        Vector reportResults = (Vector)getServerSession("fieldaccess").executeQuery(query);
         query = new ReportQuery(Employee.class, employees);
 
         Class[] argTypes = new Class[]{String.class, java.sql.Date.class, Integer.class};
@@ -168,7 +174,7 @@
         query.addItem("endDate", employees.get("period").get("endDate"));
         query.addAttribute("id");
         query.endAddingToConstructorItem();
-        Vector results = (Vector)em.getActiveSession().executeQuery(query);
+        Vector results = (Vector)getServerSession("fieldaccess").executeQuery(query);
         Iterator i = results.iterator();
         Iterator report = reportResults.iterator();
         while (i.hasNext()){
@@ -197,10 +203,10 @@
         query.addItem("endDate", employees.get("period").get("endDate"));
         query.addAttribute("id");
         query.endAddingToConstructorItem();
-        org.eclipse.persistence.jpa.JpaEntityManager em = (org.eclipse.persistence.jpa.JpaEntityManager) createEntityManager("fieldaccess");          
+        EntityManager em = createEntityManager("fieldaccess");          
         QueryException exception = null;
         try{
-            em.getActiveSession().executeQuery(query);
+            getServerSession("fieldaccess").executeQuery(query);
         } catch (QueryException ex){
             exception = ex;
         }
@@ -212,16 +218,16 @@
         ExpressionBuilder employees = new ExpressionBuilder();
         ReportQuery query = new ReportQuery(Employee.class, employees);
         query.addAttribute("salary");
-        org.eclipse.persistence.jpa.JpaEntityManager em = (org.eclipse.persistence.jpa.JpaEntityManager) createEntityManager("fieldaccess");          
+        EntityManager em = createEntityManager("fieldaccess");          
 
-        Vector reportResults = (Vector)em.getActiveSession().executeQuery(query);
+        Vector reportResults = (Vector)getServerSession("fieldaccess").executeQuery(query);
 
         query = new ReportQuery(Employee.class, employees);
         Class[] argTypes = new Class[]{int.class};
         query.beginAddingConstructorArguments(DataHolder.class, argTypes);
         query.addAttribute("salary");
         query.endAddingToConstructorItem();
-        Vector results = (Vector)em.getActiveSession().executeQuery(query);
+        Vector results = (Vector)getServerSession("fieldaccess").executeQuery(query);
         Iterator i = results.iterator();
         Iterator report = reportResults.iterator();
         while (i.hasNext()){
@@ -250,9 +256,9 @@
         ReportQuery query = new ReportQuery(Employee.class, employees);
         query.addAttribute("firstName");
         query.addAttribute("lastName");
-        org.eclipse.persistence.jpa.JpaEntityManager em = (org.eclipse.persistence.jpa.JpaEntityManager) createEntityManager("fieldaccess");          
+        EntityManager em = createEntityManager("fieldaccess");          
 
-        Vector reportResults = (Vector)em.getActiveSession().executeQuery(query);
+        Vector reportResults = (Vector)getServerSession("fieldaccess").executeQuery(query);
 
         ConstructorReportItem citem = new ConstructorReportItem("Employee");
         citem.setResultType(Employee.class);
@@ -262,7 +268,7 @@
         
         query.addConstructorReportItem(citem);
 
-        Vector results = (Vector)em.getActiveSession().executeQuery(query);
+        Vector results = (Vector)getServerSession("fieldaccess").executeQuery(query);
         Iterator i = results.iterator();
         Iterator report = reportResults.iterator();
         while (i.hasNext()){
Index: src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/ReportQueryMultipleReturnTestSuite.java
===================================================================
--- src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/ReportQueryMultipleReturnTestSuite.java	(revision 2970)
+++ src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/ReportQueryMultipleReturnTestSuite.java	(working copy)
@@ -60,7 +60,7 @@
         ExpressionBuilder empbuilder = new ExpressionBuilder();
         reportQuery.addAttribute("salary",empbuilder.get("salary"));
         reportQuery.setSelectionCriteria(empbuilder.get("salary").greaterThan(1));
-        List result = (List)((EntityManagerImpl)createEntityManager("fieldaccess")).getActiveSession().executeQuery(reportQuery);
+        List result = (List)getServerSession("fieldaccess").executeQuery(reportQuery);
         Object resultItem = result.get(0);
         assertTrue("Failed to return Employees correctly, Not A Number", Number.class.isAssignableFrom(resultItem.getClass()));
         assertTrue("Failed to return Employees correctly, Not Correct Result", ((Number)resultItem).intValue() > 1);
@@ -73,7 +73,7 @@
         ExpressionBuilder empbuilder = new ExpressionBuilder();
         reportQuery.addAttribute("manager",empbuilder.get("manager"));
         reportQuery.setSelectionCriteria(empbuilder.get("salary").greaterThan(1));
-        List result = (List)((EntityManagerImpl)createEntityManager("fieldaccess")).getActiveSession().executeQuery(reportQuery);
+        List result = (List)getServerSession("fieldaccess").executeQuery(reportQuery);
         Object resultItem = result.get(0);
         assertTrue("Failed to return Employees correctly, Not An Employee", Employee.class.isAssignableFrom(resultItem.getClass()));
     }
@@ -86,7 +86,7 @@
         reportQuery.addAttribute("salary",empbuilder.get("salary"));
         reportQuery.addAttribute("manager",empbuilder.get("manager"));
         reportQuery.setSelectionCriteria(empbuilder.get("salary").greaterThan(1));
-        List result = (List)((EntityManagerImpl)createEntityManager("fieldaccess")).getActiveSession().executeQuery(reportQuery);
+        List result = (List)getServerSession("fieldaccess").executeQuery(reportQuery);
         Object innerResult = result.get(0);
         assertTrue("Failed to return Employees correctly, Not an Object Array", Object[].class.isAssignableFrom(innerResult.getClass()));
         Object resultItem = ((Object[])innerResult)[0];
@@ -106,7 +106,7 @@
         reportQuery.addAttribute("manager",empbuilder.get("manager"));
         reportQuery.addAttribute("adress.city",addBuilder.get("city"));
         reportQuery.setSelectionCriteria(empbuilder.get("salary").greaterThan(1));
-        List result = (List)((EntityManagerImpl)createEntityManager("fieldaccess")).getActiveSession().executeQuery(reportQuery);
+        List result = (List)getServerSession("fieldaccess").executeQuery(reportQuery);
         Object innerResult = result.get(0);
         assertTrue("Failed to return Employees correctly, Not an Object Array", Object[].class.isAssignableFrom(innerResult.getClass()));
         Object resultItem = ((Object[])innerResult)[0];
@@ -125,7 +125,7 @@
             reportQuery.setReferenceClass(Project.class);
             ExpressionBuilder empbuilder = new ExpressionBuilder();
             reportQuery.addAttribute("project",empbuilder);
-            List result = (List)((EntityManagerImpl)createEntityManager("fieldaccess")).getActiveSession().executeQuery(reportQuery);
+            List result = (List)getServerSession("fieldaccess").executeQuery(reportQuery);
         }catch (QueryException ex){
            return; 
         }
@@ -138,7 +138,7 @@
         reportQuery.setReferenceClass(LargeProject.class);
         ExpressionBuilder empbuilder = new ExpressionBuilder();
         reportQuery.addAttribute("project",empbuilder);
-        List result = (List)((EntityManagerImpl)createEntityManager("fieldaccess")).getActiveSession().executeQuery(reportQuery);
+        List result = (List)getServerSession("fieldaccess").executeQuery(reportQuery);
         Object resultItem = result.get(0);
         assertTrue("Failed to return Project as expression root correctly, Not A Project", LargeProject.class.isAssignableFrom(resultItem.getClass()));
     }
Index: src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/UpdateAllQueryAdvancedJunitTest.java
===================================================================
--- src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/UpdateAllQueryAdvancedJunitTest.java	(revision 2970)
+++ src/org/eclipse/persistence/testing/tests/jpa/fieldaccess/advanced/UpdateAllQueryAdvancedJunitTest.java	(working copy)
@@ -20,6 +20,8 @@
 import junit.extensions.TestSetup;
 import junit.framework.*;
 
+import javax.persistence.EntityManager;
+
 import org.eclipse.persistence.descriptors.ClassDescriptor;
 import org.eclipse.persistence.expressions.Expression;
 import org.eclipse.persistence.expressions.ExpressionBuilder;
@@ -96,120 +98,243 @@
     }
     
     public static Test suite() {
-        TestSuite suite = new TestSuite(UpdateAllQueryAdvancedJunitTest.class);
+        TestSuite suite = new TestSuite();
+        suite.setName("UpdateAllQueryAdvancedJunitTest (fieldaccess)");
         
-        return new TestSetup(suite) {
-            protected void setUp(){               
-                new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession());
-            }
-
-            protected void tearDown() {
-                clearCache("fieldaccess");
-            }
-        };
+        suite.addTest(new UpdateAllQueryAdvancedJunitTest("testSetup"));
+        suite.addTest(new UpdateAllQueryAdvancedJunitTest("testFirstNamePrefixBLAForAll"));
+        suite.addTest(new UpdateAllQueryAdvancedJunitTest("testFirstNamePrefixBLAForSalary"));
+        suite.addTest(new UpdateAllQueryAdvancedJunitTest("testDoubleSalaryForAll"));
+        suite.addTest(new UpdateAllQueryAdvancedJunitTest("testDoubleSalaryForSalary"));
+        suite.addTest(new UpdateAllQueryAdvancedJunitTest("testFirstNamePrefixBLADoubleSalaryForAll"));
+        suite.addTest(new UpdateAllQueryAdvancedJunitTest("testFirstNamePrefixBLADoubleSalaryForSalary"));
+        suite.addTest(new UpdateAllQueryAdvancedJunitTest("testFirstNamePrefixBLADoubleSalaryForSalaryForFirstName"));
+        suite.addTest(new UpdateAllQueryAdvancedJunitTest("testAssignManagerName"));
+        suite.addTest(new UpdateAllQueryAdvancedJunitTest("testAssignNullToAddress"));
+        suite.addTest(new UpdateAllQueryAdvancedJunitTest("testAssignObjectToAddress"));
+        suite.addTest(new UpdateAllQueryAdvancedJunitTest("testAssignExpressionToAddress"));
+        suite.addTest(new UpdateAllQueryAdvancedJunitTest("testAggregate"));
+        
+        return suite;
     }
     
-    public static void testFirstNamePrefixBLAForAll() {
-        ExpressionBuilder builder = new ExpressionBuilder();
-        UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class);        
-        updateQuery.addUpdate("firstName", Expression.fromLiteral("'BLA'", null).concat(builder.get("firstName")));
-        updateAllQueryInternal(updateQuery);
-    }    
+    /**
+     * The setup is done as a test, both to record its failure, and to allow execution in the server.
+     */
+    public void testSetup() {
+        new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("fieldaccess"));
+        clearCache("fieldaccess");
+    }
     
-    public static void testFirstNamePrefixBLAForSalary() {
-        ExpressionBuilder builder = new ExpressionBuilder();
-        Expression selectionExpression = builder.get("salary").lessThan(20000);
-        UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class, selectionExpression);
-        updateQuery.addUpdate("firstName", Expression.fromLiteral("'BLA'", null).concat(builder.get("firstName")));
-        updateAllQueryInternal(updateQuery);
-    }    
+    public void testFirstNamePrefixBLAForAll() {
+        EntityManager em = createEntityManager("fieldaccess");
+        beginTransaction(em);
+        try{
+            ExpressionBuilder builder = new ExpressionBuilder();
+            UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class);        
+            updateQuery.addUpdate("firstName", Expression.fromLiteral("'BLA'", null).concat(builder.get("firstName")));
+            updateAllQueryInternal(updateQuery);
+        }finally{
+            if (isTransactionActive(em)){
+                rollbackTransaction(em);
+            }
+            closeEntityManager(em);
+        }
+    }
     
-    public static void testDoubleSalaryForAll() {
-        ExpressionBuilder builder = new ExpressionBuilder();
-        UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class);
-        updateQuery.addUpdate("salary", ExpressionMath.multiply(builder.get("salary"), new Integer(2)));
-        updateAllQueryInternal(updateQuery);
-    }    
+    public void testFirstNamePrefixBLAForSalary() {
+        EntityManager em = createEntityManager("fieldaccess");
+        beginTransaction(em);
+        try{
+            ExpressionBuilder builder = new ExpressionBuilder();
+            Expression selectionExpression = builder.get("salary").lessThan(20000);
+            UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class, selectionExpression);
+            updateQuery.addUpdate("firstName", Expression.fromLiteral("'BLA'", null).concat(builder.get("firstName")));
+            updateAllQueryInternal(updateQuery);
+        }finally{
+            if (isTransactionActive(em)){
+                rollbackTransaction(em);
+            }
+            closeEntityManager(em);
+        }
+    }
     
-    public static void testDoubleSalaryForSalary() {
-        ExpressionBuilder builder = new ExpressionBuilder();
-        Expression selectionExpression = builder.get("salary").lessThan(20000);
-        UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class, selectionExpression);
-        updateQuery.addUpdate("salary", ExpressionMath.multiply(builder.get("salary"), new Integer(2)));
-        updateAllQueryInternal(updateQuery);
-    }    
+    public void testDoubleSalaryForAll() {
+        EntityManager em = createEntityManager("fieldaccess");
+        beginTransaction(em);
+        try{
+            ExpressionBuilder builder = new ExpressionBuilder();
+            UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class);
+            updateQuery.addUpdate("salary", ExpressionMath.multiply(builder.get("salary"), new Integer(2)));
+            updateAllQueryInternal(updateQuery);
+        }finally{
+            if (isTransactionActive(em)){
+                rollbackTransaction(em);
+            }
+            closeEntityManager(em);
+        }
+    }
     
-    public static void testFirstNamePrefixBLADoubleSalaryForAll() {
-        ExpressionBuilder builder = new ExpressionBuilder();
-        UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class);
-        updateQuery.addUpdate("firstName", Expression.fromLiteral("'BLA'", null).concat(builder.get("firstName")));
-        updateQuery.addUpdate("salary", ExpressionMath.multiply(builder.get("salary"), new Integer(2)));
-        updateAllQueryInternal(updateQuery);
-    }    
+    public void testDoubleSalaryForSalary() {
+        EntityManager em = createEntityManager("fieldaccess");
+        beginTransaction(em);
+        try{
+            ExpressionBuilder builder = new ExpressionBuilder();
+            Expression selectionExpression = builder.get("salary").lessThan(20000);
+            UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class, selectionExpression);
+            updateQuery.addUpdate("salary", ExpressionMath.multiply(builder.get("salary"), new Integer(2)));
+            updateAllQueryInternal(updateQuery);
+        }finally{
+            if (isTransactionActive(em)){
+                rollbackTransaction(em);
+            }
+            closeEntityManager(em);
+        }
+    }
     
-    public static void testFirstNamePrefixBLADoubleSalaryForSalary() {
-        ExpressionBuilder builder = new ExpressionBuilder();
-        Expression selectionExpression = builder.get("salary").lessThan(20000);
-        UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class, selectionExpression);
-        updateQuery.addUpdate("firstName", Expression.fromLiteral("'BLA'", null).concat(builder.get("firstName")));
-        updateQuery.addUpdate("salary", ExpressionMath.multiply(builder.get("salary"), new Integer(2)));
-        updateAllQueryInternal(updateQuery);
-    }    
+    public void testFirstNamePrefixBLADoubleSalaryForAll() {
+        EntityManager em = createEntityManager("fieldaccess");
+        beginTransaction(em);
+        try{
+            ExpressionBuilder builder = new ExpressionBuilder();
+            UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class);
+            updateQuery.addUpdate("firstName", Expression.fromLiteral("'BLA'", null).concat(builder.get("firstName")));
+            updateQuery.addUpdate("salary", ExpressionMath.multiply(builder.get("salary"), new Integer(2)));
+            updateAllQueryInternal(updateQuery);
+        }finally{
+            if (isTransactionActive(em)){
+                rollbackTransaction(em);
+            }
+            closeEntityManager(em);
+        }
+    }
     
-    public static void testFirstNamePrefixBLADoubleSalaryForSalaryForFirstName() {
-        ExpressionBuilder builder = new ExpressionBuilder();
-        Expression selectionExpression = builder.get("salary").lessThan(20000).and(builder.get("firstName").like("J%"));
-        UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class, selectionExpression);
-        updateQuery.addUpdate("firstName", Expression.fromLiteral("'BLA'", null).concat(builder.get("firstName")));
-        updateQuery.addUpdate("salary", ExpressionMath.multiply(builder.get("salary"), new Integer(2)));
-        updateAllQueryInternal(updateQuery);
-    }    
+    public void testFirstNamePrefixBLADoubleSalaryForSalary() {
+        EntityManager em = createEntityManager("fieldaccess");
+        beginTransaction(em);
+        try{
+            ExpressionBuilder builder = new ExpressionBuilder();
+            Expression selectionExpression = builder.get("salary").lessThan(20000);
+            UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class, selectionExpression);
+            updateQuery.addUpdate("firstName", Expression.fromLiteral("'BLA'", null).concat(builder.get("firstName")));
+            updateQuery.addUpdate("salary", ExpressionMath.multiply(builder.get("salary"), new Integer(2)));
+            updateAllQueryInternal(updateQuery);
+        }finally{
+            if (isTransactionActive(em)){
+                rollbackTransaction(em);
+            }
+            closeEntityManager(em);
+        }
+    }
     
-    public static void testAssignManagerName() {
-        ExpressionBuilder builder = new ExpressionBuilder();    
-        Expression selectionExpression = builder.get("manager").notNull();
-        UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class, selectionExpression);
-        updateQuery.addUpdate("firstName", builder.get("manager").get("firstName"));
-        updateAllQueryInternal(updateQuery);
-    }    
+    public void testFirstNamePrefixBLADoubleSalaryForSalaryForFirstName() {
+        EntityManager em = createEntityManager("fieldaccess");
+        beginTransaction(em);
+        try{
+            ExpressionBuilder builder = new ExpressionBuilder();
+            Expression selectionExpression = builder.get("salary").lessThan(20000).and(builder.get("firstName").like("J%"));
+            UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class, selectionExpression);
+            updateQuery.addUpdate("firstName", Expression.fromLiteral("'BLA'", null).concat(builder.get("firstName")));
+            updateQuery.addUpdate("salary", ExpressionMath.multiply(builder.get("salary"), new Integer(2)));
+            updateAllQueryInternal(updateQuery);
+        }finally{
+            if (isTransactionActive(em)){
+                rollbackTransaction(em);
+            }
+            closeEntityManager(em);
+        }
+    }
     
-    public static void testAssignNullToAddress() {
-        UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class);
-        updateQuery.addUpdate("address", null);
-        updateAllQueryInternal(updateQuery);
-    }    
+    public void testAssignManagerName() {
+        EntityManager em = createEntityManager("fieldaccess");
+        beginTransaction(em);
+        try{
+            ExpressionBuilder builder = new ExpressionBuilder();    
+            Expression selectionExpression = builder.get("manager").notNull();
+            UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class, selectionExpression);
+            updateQuery.addUpdate("firstName", builder.get("manager").get("firstName"));
+            updateAllQueryInternal(updateQuery);
+        }finally{
+            if (isTransactionActive(em)){
+                rollbackTransaction(em);
+            }
+            closeEntityManager(em);
+        }
+    }
     
-    public static void testAssignObjectToAddress() {
-        Address address = new Address();
-        address.setCountry("Canada");
-        address.setProvince("Ontario");
-        address.setCity("Ottawa");
-        address.setStreet("O'Connor");
-        UnitOfWork uow = acquireUnitOfWork();
-        uow.registerNewObject(address);
-        uow.commit();
-        UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class);
-        updateQuery.addUpdate("address", address);
-        updateAllQueryInternal(updateQuery);
-    }    
+    public void testAssignNullToAddress() {
+        EntityManager em = createEntityManager("fieldaccess");
+        beginTransaction(em);
+        try{
+            UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class);
+            updateQuery.addUpdate("address", null);
+            updateAllQueryInternal(updateQuery);
+        }finally{
+            if (isTransactionActive(em)){
+                rollbackTransaction(em);
+            }
+            closeEntityManager(em);
+        }
+    }
     
-    public static void testAssignExpressionToAddress() {
-        ExpressionBuilder builder = new ExpressionBuilder();    
-        Expression selectionExpression = builder.get("manager").notNull();
-        UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class, selectionExpression);
-        updateQuery.addUpdate("address", builder.get("manager").get("address"));
-        updateAllQueryInternal(updateQuery);
-    }    
+    public void testAssignObjectToAddress() {
+        EntityManager em = createEntityManager("fieldaccess");
+        beginTransaction(em);
+        try{
+            Address address = new Address();
+            address.setCountry("Canada");
+            address.setProvince("Ontario");
+            address.setCity("Ottawa");
+            address.setStreet("O'Connor");
+            UnitOfWork uow = acquireUnitOfWork();
+            uow.registerNewObject(address);
+            uow.commit();
+            UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class);
+            updateQuery.addUpdate("address", address);
+            updateAllQueryInternal(updateQuery);
+        }finally{
+            if (isTransactionActive(em)){
+                rollbackTransaction(em);
+            }
+            closeEntityManager(em);
+        }
+    }
     
-    public static void testAggregate() {
-        ExpressionBuilder builder = new ExpressionBuilder();    
-        Expression selectionExpression = builder.get("manager").notNull();
-        UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class, selectionExpression);
-        updateQuery.addUpdate(builder.get("period").get("startDate"), builder.get("period").get("endDate"));
-        updateQuery.addUpdate(builder.get("period").get("endDate"), builder.get("period").get("startDate"));
-        updateAllQueryInternal(updateQuery);
+    public void testAssignExpressionToAddress() {
+        EntityManager em = createEntityManager("fieldaccess");
+        beginTransaction(em);
+        try{
+            ExpressionBuilder builder = new ExpressionBuilder();    
+            Expression selectionExpression = builder.get("manager").notNull();
+            UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class, selectionExpression);
+            updateQuery.addUpdate("address", builder.get("manager").get("address"));
+            updateAllQueryInternal(updateQuery);
+        }finally{
+            if (isTransactionActive(em)){
+                rollbackTransaction(em);
+            }
+            closeEntityManager(em);
+        }
     }
     
+    public void testAggregate() {
+        EntityManager em = createEntityManager("fieldaccess");
+        beginTransaction(em);
+        try{
+            ExpressionBuilder builder = new ExpressionBuilder();    
+            Expression selectionExpression = builder.get("manager").notNull();
+            UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class, selectionExpression);
+            updateQuery.addUpdate(builder.get("period").get("startDate"), builder.get("period").get("endDate"));
+            updateQuery.addUpdate(builder.get("period").get("endDate"), builder.get("period").get("startDate"));
+            updateAllQueryInternal(updateQuery);
+        }finally{
+            if (isTransactionActive(em)){
+                rollbackTransaction(em);
+            }
+            closeEntityManager(em);
+        }
+    }
+    
     protected static void updateAllQueryInternal(Class referenceClass, HashMap updateClauses, Expression selectionExpression) {
         String errorMsg = UpdateAllQueryTestHelper.execute(getDbSession(), referenceClass, updateClauses, selectionExpression);
         if(errorMsg != null) {
Index: src/org/eclipse/persistence/testing/tests/jpa/inheritance/ServerTestSuite.java
===================================================================
--- src/org/eclipse/persistence/testing/tests/jpa/inheritance/ServerTestSuite.java	(revision 2970)
+++ src/org/eclipse/persistence/testing/tests/jpa/inheritance/ServerTestSuite.java	(working copy)
@@ -27,6 +27,7 @@
         suite.addTest(EntityManagerJUnitTestCase.suite());
         suite.addTest(MixedInheritanceJUnitTestCase.suite());
         suite.addTest(JoinedAttributeInheritanceJunitTest.suite());
+        suite.addTest(TablePerClassInheritanceJUnitTest.suite());
         
         return suite;
     }
Index: src/org/eclipse/persistence/testing/tests/jpa/inheritance/TablePerClassInheritanceJUnitTest.java
===================================================================
--- src/org/eclipse/persistence/testing/tests/jpa/inheritance/TablePerClassInheritanceJUnitTest.java	(revision 2970)
+++ src/org/eclipse/persistence/testing/tests/jpa/inheritance/TablePerClassInheritanceJUnitTest.java	(working copy)
@@ -597,7 +597,6 @@
             //updateQuery.setSelectionCriteria(eb.get("name"));
             updateQuery.addUpdate(eb.get("name"), "Generic Assassin Name");
             ((JpaEntityManager) em).getServerSession().executeQuery(updateQuery);
-            
             Assassin assassin = (Assassin) em.find(ContractedPersonel.class, assassinId);
             em.refresh(assassin);
             

Back to the top