Search in sources :

Example 1 with EnvironmentBuilder

use of org.drools.persistence.map.EnvironmentBuilder in project drools by kiegroup.

the class MapBasedPersistenceTest method disposeAndReloadSession.

@Override
protected KieSession disposeAndReloadSession(KieSession ksession, KieBase kbase) {
    long sessionId = ksession.getIdentifier();
    ksession.dispose();
    EnvironmentBuilder envBuilder = new KnowledgeSessionStorageEnvironmentBuilder(storage);
    Environment env = KieServices.Factory.get().newEnvironment();
    env.set(EnvironmentName.TRANSACTION_MANAGER, envBuilder.getTransactionManager());
    env.set(EnvironmentName.PERSISTENCE_CONTEXT_MANAGER, envBuilder.getPersistenceContextManager());
    return JPAKnowledgeService.loadStatefulKnowledgeSession(sessionId, kbase, null, env);
}
Also used : KnowledgeSessionStorageEnvironmentBuilder(org.drools.persistence.map.KnowledgeSessionStorageEnvironmentBuilder) EnvironmentBuilder(org.drools.persistence.map.EnvironmentBuilder) KnowledgeSessionStorageEnvironmentBuilder(org.drools.persistence.map.KnowledgeSessionStorageEnvironmentBuilder) Environment(org.kie.api.runtime.Environment)

Example 2 with EnvironmentBuilder

use of org.drools.persistence.map.EnvironmentBuilder in project drools by kiegroup.

the class MapBasedPersistenceTest method createSession.

@Override
protected KieSession createSession(KieBase kbase) {
    EnvironmentBuilder envBuilder = new KnowledgeSessionStorageEnvironmentBuilder(storage);
    Environment env = KieServices.Factory.get().newEnvironment();
    env.set(EnvironmentName.TRANSACTION_MANAGER, envBuilder.getTransactionManager());
    env.set(EnvironmentName.PERSISTENCE_CONTEXT_MANAGER, envBuilder.getPersistenceContextManager());
    return JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
}
Also used : KnowledgeSessionStorageEnvironmentBuilder(org.drools.persistence.map.KnowledgeSessionStorageEnvironmentBuilder) EnvironmentBuilder(org.drools.persistence.map.EnvironmentBuilder) KnowledgeSessionStorageEnvironmentBuilder(org.drools.persistence.map.KnowledgeSessionStorageEnvironmentBuilder) Environment(org.kie.api.runtime.Environment)

Aggregations

EnvironmentBuilder (org.drools.persistence.map.EnvironmentBuilder)2 KnowledgeSessionStorageEnvironmentBuilder (org.drools.persistence.map.KnowledgeSessionStorageEnvironmentBuilder)2 Environment (org.kie.api.runtime.Environment)2