Author: epbernard
Date: 2008-10-08 22:50:26 -0400 (Wed, 08 Oct 2008)
New Revision: 15298
Modified:
entitymanager/trunk/src/test/org/hibernate/ejb/test/TestCase.java
entitymanager/trunk/src/test/org/hibernate/ejb/test/emops/FlushModeTest.java
Log:
Fix test case rework error when passign argument on em creation
Modified: entitymanager/trunk/src/test/org/hibernate/ejb/test/TestCase.java
===================================================================
--- entitymanager/trunk/src/test/org/hibernate/ejb/test/TestCase.java 2008-10-09 01:33:00
UTC (rev 15297)
+++ entitymanager/trunk/src/test/org/hibernate/ejb/test/TestCase.java 2008-10-09 02:50:26
UTC (rev 15298)
@@ -57,9 +57,12 @@
return em;
}
- protected EntityManager getEntityManager(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/trunk/src/test/org/hibernate/ejb/test/emops/FlushModeTest.java
===================================================================
---
entitymanager/trunk/src/test/org/hibernate/ejb/test/emops/FlushModeTest.java 2008-10-09
01:33:00 UTC (rev 15297)
+++
entitymanager/trunk/src/test/org/hibernate/ejb/test/emops/FlushModeTest.java 2008-10-09
02:50:26 UTC (rev 15298)
@@ -15,7 +15,7 @@
public void testCreateEMFlushMode() throws Exception {
Map properties = new HashMap();
properties.put( "org.hibernate.flushMode", "manual" );
- EntityManager em = getEntityManager( properties );
+ EntityManager em = createEntityManager( properties );
em.getTransaction().begin();
Dress dress = new Dress();
dress.name = "long dress";
Show replies by date