@Test public void testAddAndThrowException() throws Exception { String name = "Bar"; assertFalse(queriesEJB.isInDB(name)); try { ejb.addAndThrowException(name); fail(); } catch (Exception e){ } assertTrue(queriesEJB.isInDB(name)); }
public void addAndThrowException(String name) throws Exception { Foo foo = new Foo(name); em.persist(foo); throw new Exception("Checked exceptions will not lead to rollback"); }
EJB_11_exceptions { public void addAndThrowException(String name) throws Exception { Foo foo = new Foo(name); em.persist(foo); throw new Exception("Checked exceptions will not lead to rollback"); } }
EJB_11_exceptions { public void addAndThrowException(String name) throws Exception { Foo foo = new Foo(name); em.persist(foo); throw new Exception("Checked exceptions will not lead to rollback"); }  }
EJB_11_exceptions { public void addAndThrowException(String name) throws Exception { Foo foo = new Foo(name); em.persist(foo); throw new Exception("Checked exceptions will not lead to rollback"); }  void addAndThrowRuntimeException(String name); void addAndThrowException(String name); void addAndThrowRuntimeExceptionNoRollback(String name); void addAndThrowExceptionWithRollback(String name); }
EJB_11_exceptions { public void addAndThrowException(String name) throws Exception { Foo foo = new Foo(name); em.persist(foo); throw new Exception("Checked exceptions will not lead to rollback"); }  void addAndThrowRuntimeException(String name); void addAndThrowException(String name); void addAndThrowRuntimeExceptionNoRollback(String name); void addAndThrowExceptionWithRollback(String name);  }