public void setRollbackOnly() {
   EntityTransaction tx = this.entityManagerHolder.getEntityManager().getTransaction();
   if (tx.isActive()) {
     tx.setRollbackOnly();
   }
   if (hasConnectionHolder()) {
     getConnectionHolder().setRollbackOnly();
   }
 }
Ejemplo n.º 2
0
  @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();
  }
Ejemplo n.º 3
0
 @Override
 public void doMarkTransactionAsRollbackOnly(EntityTransaction entityTransaction) {
   entityTransaction.setRollbackOnly();
 }