Search in sources :

Example 1 with JtaTransactionManager

use of org.drools.persistence.jta.JtaTransactionManager in project drools by kiegroup.

the class JpaBasedPersistenceTest method setUp.

@Before
public void setUp() throws Exception {
    context = DroolsPersistenceUtil.setupWithPoolingDataSource(DROOLS_PERSISTENCE_UNIT_NAME);
    emf = (EntityManagerFactory) context.get(ENTITY_MANAGER_FACTORY);
    if (useTransactions()) {
        useTransactions = true;
        Environment env = createEnvironment(context);
        Object tm = env.get(EnvironmentName.TRANSACTION_MANAGER);
        this.txm = new JtaTransactionManager(env.get(EnvironmentName.TRANSACTION), env.get(EnvironmentName.TRANSACTION_SYNCHRONIZATION_REGISTRY), tm);
    }
}
Also used : JtaTransactionManager(org.drools.persistence.jta.JtaTransactionManager) DroolsPersistenceUtil.createEnvironment(org.drools.persistence.util.DroolsPersistenceUtil.createEnvironment) Environment(org.kie.api.runtime.Environment) Before(org.junit.Before)

Aggregations

JtaTransactionManager (org.drools.persistence.jta.JtaTransactionManager)1 DroolsPersistenceUtil.createEnvironment (org.drools.persistence.util.DroolsPersistenceUtil.createEnvironment)1 Before (org.junit.Before)1 Environment (org.kie.api.runtime.Environment)1