[hibernate-commits] Hibernate SVN: r15314 - in entitymanager/branches/v3_2_1_GA_CP/src/test/org/hibernate/ejb/test: emops and 1 other directory.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Thu Oct 9 17:22:50 EDT 2008


Author: cbredesen
Date: 2008-10-09 17:22:50 -0400 (Thu, 09 Oct 2008)
New Revision: 15314

Modified:
   entitymanager/branches/v3_2_1_GA_CP/src/test/org/hibernate/ejb/test/TestCase.java
   entitymanager/branches/v3_2_1_GA_CP/src/test/org/hibernate/ejb/test/emops/FlushModeTest.java
Log:
Applied patch recommended in JBPAPP-1271

Modified: entitymanager/branches/v3_2_1_GA_CP/src/test/org/hibernate/ejb/test/TestCase.java
===================================================================
--- entitymanager/branches/v3_2_1_GA_CP/src/test/org/hibernate/ejb/test/TestCase.java	2008-10-09 19:28:35 UTC (rev 15313)
+++ entitymanager/branches/v3_2_1_GA_CP/src/test/org/hibernate/ejb/test/TestCase.java	2008-10-09 21:22:50 UTC (rev 15314)
@@ -65,9 +65,12 @@
 		return em;
 	}
 
-	protected EntityManager getOrCreateEntityManager(Map properties) {
-		if (em == null || !em.isOpen()) 
-			em = factory.createEntityManager(properties);
+	/** always reopen a new EM and clse the existing one */
+	protected EntityManager createEntityManager(Map properties) {
+		if (em != null && em.isOpen() ) {
+			em.close();
+		}
+		em = factory.createEntityManager(properties);
 		return em;
 	}
 

Modified: entitymanager/branches/v3_2_1_GA_CP/src/test/org/hibernate/ejb/test/emops/FlushModeTest.java
===================================================================
--- entitymanager/branches/v3_2_1_GA_CP/src/test/org/hibernate/ejb/test/emops/FlushModeTest.java	2008-10-09 19:28:35 UTC (rev 15313)
+++ entitymanager/branches/v3_2_1_GA_CP/src/test/org/hibernate/ejb/test/emops/FlushModeTest.java	2008-10-09 21:22:50 UTC (rev 15314)
@@ -15,7 +15,7 @@
 	public void testCreateEMFlushMode() throws Exception {
 		Map properties = new HashMap();
 		properties.put( "org.hibernate.flushMode", "manual" );
-		EntityManager em = getOrCreateEntityManager( properties );
+		EntityManager em = createEntityManager( properties );
 		em.getTransaction().begin();
 		Dress dress = new Dress();
 		dress.name  = "long dress";




More information about the hibernate-commits mailing list