06-11-2014 11:41 AM
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProcess", variables);
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="DAO">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
…my classes…
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/orderbase" />
<property name="hibernate.connection.username" value="user" />
<property name="hibernate.connection.password" value="pwd1" />
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>
</persistence>
ProcessEngineConfigurationImpl pEC = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
pEC.setJpaPersistenceUnitName("DAO")
.setJpaHandleTransaction(true)
.setDatabaseSchemaUpdate("false")
.setJdbcDriver("com.mysql.jdbc.Driver")
.setJdbcUrl("jdbc:mysql://localhost:3306/activiti")
.setJobExecutorActivate(false)
.setJdbcUsername("user")
.setJdbcPassword("pwd");
processEngine = pEC.buildProcessEngine();
EntityManagerSessionFactory entityManagerSessionFactory = (EntityManagerSessionFactory) pEC
.getSessionFactories()
.get(EntityManagerSession.class);
entityManagerFactory = entityManagerSessionFactory.getEntityManagerFactory();
EntityManager manager = entityManagerFactory.createEntityManager();
manager.getTransaction().begin();
Order newOrder=new Order();
…doing stuff here order related….
manager.persist(newOrder);
manager.flush();
manager.getTransaction().commit();
manager.close();
variables.put("order", newOrder);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProcess", variables);
public class ServiceTaskNewOrder implements JavaDelegate{
@Override
public void execute(DelegateExecution execution) throws Exception {
//this works ok, but how can I create here an entity that will be stored into my second not-activiti database?
Order o = (Order) execution.getVariable("order");
}
}
06-17-2014 06:25 AM
06-20-2014 09:11 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.