1

I've just started working with activity and integrated it in my project (postgres based) in an embedded way (sample spring configuration file snip)

    (...)
    <!-- Activiti components -->
    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
        <property name="dataSource" ref="dataSource" />
        <property name="transactionManager" ref="transactionManager" />
        <property name="databaseSchemaUpdate" value="true" />
        <property name="jobExecutorActivate" value="false" />
    </bean>

    <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
        <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" />

    (...)

It works well and create a lot of tables on my application schema at startup.

My problem is : tables are created in the 'public' schema in my postgres database. I would have preferred to put those tables in a separate schema, say 'activity'.

Fact is that after browsing the documentation / the net for almost two hours, I didn't found any way to change the default schema target creation behavior.

Any help... greatly appreciated ! ;)

M'λ'
  • 631
  • 7
  • 18
  • You can try: 1) remove public from [search path](http://www.postgresql.org/docs/current/static/ddl-schemas.html) 2) Create new schema `activity` 3) add schema `activity` to search path 4) create tables using activity (should be created in activity schema if create statements are not schema qualified and activity is the only schema in search path). 5) Add schema `public` back to search path (if activiti runs queries/updates without schema qualification then it should work). – Tomas Greif Feb 14 '14 at 20:23
  • 1
    Thomas is correct, you need to set the search path to point to the schema you want to use. – Greg Harley Feb 17 '14 at 20:32

1 Answers1

0

Since Postgres 9.4 JDBC driver you can specify the default schema in the JDBC url like this: jdbc:postgresql://localhost:5432/mydatabase?currentSchema=myschema

With this URL, all Activiti tables are created in the myschema schema instead of the default one in the search path, usually public.

Sources: this response on Stack Overflow and the latest documentation.

Sylvain Bugat
  • 6,274
  • 3
  • 25
  • 28