Search in sources :

Example 1 with TransactionStatus

use of io.micronaut.transaction.TransactionStatus in project micronaut-test by micronaut-projects.

the class JpaNoRollbackTest method cleanup.

@AfterAll
void cleanup() {
    final TransactionStatus tx = transactionManager.getTransaction(new DefaultTransactionDefinition());
    final CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
    final CriteriaDelete<Book> delete = criteriaBuilder.createCriteriaDelete(Book.class);
    delete.from(Book.class);
    entityManager.createQuery(delete).executeUpdate();
    transactionManager.commit(tx);
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) DefaultTransactionDefinition(io.micronaut.transaction.support.DefaultTransactionDefinition) TransactionStatus(io.micronaut.transaction.TransactionStatus) AfterAll(org.junit.jupiter.api.AfterAll)

Aggregations

TransactionStatus (io.micronaut.transaction.TransactionStatus)1 DefaultTransactionDefinition (io.micronaut.transaction.support.DefaultTransactionDefinition)1 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 AfterAll (org.junit.jupiter.api.AfterAll)1