// Initialize drools environment stuff
Environment env = createEnvironment(context);
KnowledgeBase kbase = initializeKnowledgeBase(simpleRule);
StatefulKnowledgeSession commandKSession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );
SingleSessionCommandService commandService = (SingleSessionCommandService) ((CommandBasedStatefulKnowledgeSession) commandKSession).getCommandService();
JpaPersistenceContextManager jpm = (JpaPersistenceContextManager) getValueOfField("jpm", commandService);
jpm.getApplicationScopedPersistenceContext();
EntityManager em = (EntityManager) getValueOfField("appScopedEntityManager", jpm);