cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti database tables are re-created...

niyazi_capar
Champ in-the-making
Champ in-the-making
Hello,

Probably I've configured something wrong as I am new to Activiti, but as soon as I deploy or start a business process within Eclipse, the Activiti tables are re-created.  Can anybody help me on this issue?

Note: I'm using org.activiti.spring.SpringProcessEngineConfiguration as a class, and MS SQL data source.

Thank you.
6 REPLIES 6

frederikherema1
Star Contributor
Star Contributor
How do you boot your process-engine? What does the engine-configuration look like?

jbarrez
Star Contributor
Star Contributor
Your config file is probably on create-drop setting?

niyazi_capar
Champ in-the-making
Champ in-the-making
The activiti.cfg.xml is what follows:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
  <property name="dataSource" ref="dataSource" />
  <property name="transactionManager" ref="transactionManager" />
  <property name="databaseSchemaUpdate" value="false" />
  <property name="jobExecutorActivate" value="true" />
</bean>
<bean class="org.activiti.spring.ProcessEngineFactoryBean" id="processEngine">
  <property name="processEngineConfiguration" ref="processEngineConfiguration" />
</bean>
<bean id="repositoryService" factory-bean="processEngine"
  factory-method="getRepositoryService" />
<bean id="runtimeService" factory-bean="processEngine"
  factory-method="getRuntimeService" />
<bean id="taskService" factory-bean="processEngine"
  factory-method="getTaskService" />
<bean id="historyService" factory-bean="processEngine"
  factory-method="getHistoryService" />
<bean id="managementService" factory-bean="processEngine"
  factory-method="getManagementService" />
<bean id="identityService" factory-bean="processEngine"
  factory-method="getIdentityService" />
</beans>


… and simple test class is:

@ContextConfiguration("classpath:activiti.cfg.xml")
public class HelloWorldTest extends SpringActivitiTestCase {


@Autowired
RuntimeService runtimeService;

@Autowired
RepositoryService repositoryService;

@Test
public void testHelloWorld() {
  System.out.println("Initializing…");
  repositoryService.createDeployment()
    .addClasspathResource("hello-world.bpmn20.xml").deploy();

  // Run
  runtimeService.startProcessInstanceByKey("helloWorld");
}

}

niyazi_capar
Champ in-the-making
Champ in-the-making
Config:
————————–
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
  <property name="dataSource" ref="dataSource" />
  <property name="transactionManager" ref="transactionManager" />
  <property name="databaseSchemaUpdate" value="false" />
  <property name="jobExecutorActivate" value="true" />
</bean>
<bean class="org.activiti.spring.ProcessEngineFactoryBean" id="processEngine">
  <property name="processEngineConfiguration" ref="processEngineConfiguration" />
</bean>
<bean id="repositoryService" factory-bean="processEngine"
  factory-method="getRepositoryService" />
<bean id="runtimeService" factory-bean="processEngine"
  factory-method="getRuntimeService" />
<bean id="taskService" factory-bean="processEngine"
  factory-method="getTaskService" />
<bean id="historyService" factory-bean="processEngine"
  factory-method="getHistoryService" />
<bean id="managementService" factory-bean="processEngine"
  factory-method="getManagementService" />
<bean id="identityService" factory-bean="processEngine"
  factory-method="getIdentityService" />
</beans>

niyazi_capar
Champ in-the-making
Champ in-the-making
Sorry for the inconvenience. I uploaded the config file as pasting to the body seems problematic.

Thank you.

jbarrez
Star Contributor
Star Contributor
That all looks fine, your setting is correct:

<code>
<property name="databaseSchemaUpdate" value="false" />
</code>

So it should work as advertised. You are simply running a unit test here?

Are you sure the config is being picked up (ie the data is in the tables)?