Is there a way to either access the internal db connection object in a script task or Java task, so that I can run an arbitrary query? I am embedding Activiti using plain java
ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration
.createStandaloneProcessEngineConfiguration()
.setJdbcUrl((String) params.get("url"))
.setJdbcDriver((String) params.get("driver"))
.setJdbcUsername((String) params.get("user"))
.setJdbcPassword((String) params.get("pword"))
.setMailServerHost((String) params.get("emailhost"))
.setMailServerPort(Integer.parseInt((String) params.get("emailport")))
.setMailServerUsername((String) params.get("emailuser"))
.setMailServerPassword((String) params.get("emailpass"))
.setMailServerDefaultFrom((String) params.get("emaildefaultfrom"))
.setJobExecutorActivate(true)
.setProcessEngineName((String) params.get("dbname"));
// add our customform types to the engine
List<AbstractFormType> customFormTypes = new ArrayList<AbstractFormType>();
customFormTypes.add(new FileFormType());
customFormTypes.add(new TextAreaFormType());
customFormTypes.add(new RadioFormType(null));
((ProcessEngineConfigurationImpl) processEngineConfiguration).setCustomFormTypes(customFormTypes);
ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
//now we can add our custom handlers for user/groups
Map<Class< ? >, SessionFactory> sessionFactories =
((ProcessEngineConfigurationImpl) processEngineConfiguration).getSessionFactories();
sessionFactories.put(UserEntityManager.class, new CustomUserEntityManagerFactory());
sessionFactories.put(GroupEntityManager.class, new CustomGroupEntityManagerFactory());
ProcessEngines.registerProcessEngine(processEngine);
everything is working fine so far, but I need to run some queries in a script or java task and I would prefer to do this with out making new database connections. Script task would be preferred as I would not need to have java class files during deployment.
Thanks