Author: jcosta(a)redhat.com
Date: 2009-04-23 06:49:02 -0400 (Thu, 23 Apr 2009)
New Revision: 16419
Modified:
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/emops/RemoveTest.java
Log:
EJB-432 - Fixed regression on RemoveTest. For branch v3_3_2_GA_CP
Modified:
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/emops/RemoveTest.java
===================================================================
---
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/emops/RemoveTest.java 2009-04-23
09:55:33 UTC (rev 16418)
+++
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/emops/RemoveTest.java 2009-04-23
10:49:02 UTC (rev 16419)
@@ -37,7 +37,7 @@
em.close();
}
- public void testUpdatedAndRemove() {
+ public void testUpdatedAndRemove() throws Exception {
Music music = new Music();
music.setName( "Classical" );
EntityManager em = getOrCreateEntityManager();
@@ -51,16 +51,21 @@
em.getTransaction().begin();
EntityManager em2 = factory.createEntityManager();
+ try {
+ em2.getTransaction().begin();
+ //read music from 2nd EM
+ music = em2.find( Music.class, music.getId() );
+ } catch (Exception e) {
+ em2.getTransaction().rollback();
+ em2.close();
+ throw e;
+ }
+
//change music
em.find( Music.class, music.getId() ).setName( "Rap" );
em.getTransaction().commit();
try {
- em2.getTransaction().begin();
-
- //read music from 2nd EM
- music = em2.find( Music.class, music.getId() );
-
em2.remove( music ); //remove changed music
em2.flush();
fail("should have an optimistic lock exception");
Show replies by date