public void setRollbackOnly() {
   EntityTransaction tx = this.entityManagerHolder.getEntityManager().getTransaction();
   if (tx.isActive()) {
     tx.setRollbackOnly();
   }
   if (hasConnectionHolder()) {
     getConnectionHolder().setRollbackOnly();
   }
 }
  @Test
  public void testSetRollbackOnly() throws Exception {
    et.setRollbackOnly();
    expect(et.isActive()).andReturn(true);
    expect(em.getTransaction()).andReturn(et).anyTimes();
    cache.put("teste", em);
    expect(producer.getCache()).andReturn(cache);
    replay(producer);
    replayAll();
    replay(em);
    replay(et);

    tx.setRollbackOnly();
    verifyAll();
  }
Beispiel #3
0
 @Override
 public void doMarkTransactionAsRollbackOnly(EntityTransaction entityTransaction) {
   entityTransaction.setRollbackOnly();
 }