Information Technology Reference
In-Depth Information
• The configuration parameters needed in the environment variable are as follows:
KieServices ks = KieServices.Factory.get();
DefaultCacheManager cm =
new DefaultCacheManager("infinispan.xml");
Environment env = ks.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, cm);
env.set(EnvironmentName.TRANSACTION_MANAGER,
new JtaTransactionManager(
TransactionManagerServices.getTransactionManager().
getCurrentTransaction(),
TransactionManagerServices.
getTransactionSynchronizationRegistry(),
TransactionManagerServices.
getTransactionManager()));
env.set(EnvironmentName.PERSISTENCE_CONTEXT_MANAGER,
new
InfinispanProcessPersistenceContextManager(env));
As you can see, the environment uses many more components. This is because the Infinis-
pan connection is still experimental and default configurations are not yet fully supported
from the initializing code. It forces us to be much more verbose, but still in a manageable
way. The main new components added to the environment that we need to discuss are as
follows:
JtaTransactionManager : The TRANSACTION_MANAGER key had a
simple TransactionManager implementation in the JPA examples. This is
because the actual JPA implementation would create this instance of
JtaTransactionManager as a wrapper to be used directly by the command
pattern in order to manage transactions that could have been started by external
components. This component has to be manually created for the Infinispan imple-
mentation.
PERSISTENCE_CONTEXT_MANAGER : This is a special object that, in the JPA
examples, is automatically created as a JPAPersistenceContextManager
object. If we manually create an object in that key, it is not overridden by the un-
derlying implementation. Therefore, we override it with a specific Infinispan im-
plementation in our case.
Search WWH ::




Custom Search