Package javax.transaction

Examples of javax.transaction.Synchronization.afterCompletion()


    assertTrue("JTA synchronization registered", synchronization != null);
    Thread thread = new Thread() {

      @Override
      public void run() {
        synchronization.afterCompletion(Status.STATUS_ROLLEDBACK);
      }
    };
    thread.start();
    thread.join();
View Full Code Here


    assertEquals("content", type.nullSafeGet(rs, new String[] {"column"}, null));
    type.nullSafeSet(ps, "content", 1);
    Synchronization synch = transaction.getSynchronization();
    assertNotNull(synch);
    synch.beforeCompletion();
    synch.afterCompletion(Status.STATUS_COMMITTED);
    verify(lobCreator).setClobAsString(ps, 1, "content");
  }

  @Test
  public void testClobStringTypeWithJtaSynchronizationAndRollback() throws Exception {
View Full Code Here

    ClobStringType type = new ClobStringType(lobHandler, tm);
    assertEquals("content", type.nullSafeGet(rs, new String[] {"column"}, null));
    type.nullSafeSet(ps, "content", 1);
    Synchronization synch = transaction.getSynchronization();
    assertNotNull(synch);
    synch.afterCompletion(Status.STATUS_ROLLEDBACK);

    verify(lobCreator).setClobAsString(ps, 1, "content");
  }

  @Test
View Full Code Here

    assertEquals(content, type.nullSafeGet(rs, new String[] {"column"}, null));
    type.nullSafeSet(ps, content, 1);
    Synchronization synch = transaction.getSynchronization();
    assertNotNull(synch);
    synch.beforeCompletion();
    synch.afterCompletion(Status.STATUS_COMMITTED);

    verify(lobCreator).setBlobAsBytes(ps, 1, contentBytes);
  }

  @Test
View Full Code Here

    BlobStringType type = new BlobStringType(lobHandler, tm);
    assertEquals(content, type.nullSafeGet(rs, new String[] {"column"}, null));
    type.nullSafeSet(ps, content, 1);
    Synchronization synch = transaction.getSynchronization();
    assertNotNull(synch);
    synch.afterCompletion(Status.STATUS_ROLLEDBACK);
    verify(lobCreator).setBlobAsBytes(ps, 1, contentBytes);
  }

  @Test
  public void testBlobByteArrayType() throws Exception {
View Full Code Here

    assertEquals(content, type.nullSafeGet(rs, new String[] {"column"}, null));
    type.nullSafeSet(ps, content, 1);
    Synchronization synch = transaction.getSynchronization();
    assertNotNull(synch);
    synch.beforeCompletion();
    synch.afterCompletion(Status.STATUS_COMMITTED);
    verify(lobCreator).setBlobAsBytes(ps, 1, content);
  }

  @Test
  public void testBlobByteArrayTypeWithJtaSynchronizationAndRollback() throws Exception {
View Full Code Here

    BlobByteArrayType type = new BlobByteArrayType(lobHandler, tm);
    assertEquals(content, type.nullSafeGet(rs, new String[] {"column"}, null));
    type.nullSafeSet(ps, content, 1);
    Synchronization synch = transaction.getSynchronization();
    assertNotNull(synch);
    synch.afterCompletion(Status.STATUS_ROLLEDBACK);
    verify(lobCreator).setBlobAsBytes(ps, 1, content);
  }

  @Test
  public void testBlobSerializableType() throws Exception {
View Full Code Here

    assertEquals("content", type.nullSafeGet(rs, new String[] {"column"}, null));
    type.nullSafeSet(ps, "content", 1);
    Synchronization synch = transaction.getSynchronization();
    assertNotNull(synch);
    synch.beforeCompletion();
    synch.afterCompletion(Status.STATUS_COMMITTED);
    verify(lobCreator).setBlobAsBytes(ps, 1, baos.toByteArray());
  }

  @Test
  public void testBlobSerializableTypeWithJtaSynchronizationAndRollback() throws Exception {
View Full Code Here

    assertEquals("content", type.nullSafeGet(rs, new String[] {"column"}, null));
    type.nullSafeSet(ps, "content", 1);
    Synchronization synch = transaction.getSynchronization();
    assertNotNull(synch);
    synch.afterCompletion(Status.STATUS_ROLLEDBACK);
    verify(lobCreator).setBlobAsBytes(ps, 1, baos.toByteArray());
  }

  @Test
  public void testHbm2JavaStyleInitialization() throws Exception {
View Full Code Here

      if ( synchronization != null ) {
        //first cleanup
        flushSynch.remove( session );
        log.debug( "flush event causing index update out of transaction" );
        synchronization.beforeCompletion();
        synchronization.afterCompletion( Status.STATUS_COMMITTED );
      }
    }
  }

  /**
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.