Spring Boot Multi databases UI using the wrong database schema

Hi,

I have just started on my flowable journey this year, I initially tried using Flowable Tomcat war deployment strategy, but I needed access to my own libraries and JPA entities so I decided to use the Flowable spring boot starters to roll my own executable spring boot app.

I required my database tables and flowables to be kept in separate schemas in a postgres database, and I achieved this thanks to this excellent post Spring Boot Integration with a different database, I have the public schema for my own tables and a separate schema for the flowable ones.

This largely works great, with the Process Engine and IDM using the correct flowable schema. However try as I might I can’t get the UI modeler to use the flowable schema. It insists on creating the following tables in my public schema:

public.act_adm_databasechangelog 
public.act_adm_databasechangeloglock 
public.act_adm_server_config 
public.act_de_databasechangelog 
public.act_de_databasechangeloglock 
public.act_de_model 
public.act_de_model_history 
public.act_de_model_relation 

And of course the UI is not picking up my existing model and forms etc contained in my flowable schema.

I have spent a lot of time flailing around in the dark trying to find a configuration which changes this, I guess Modeler is just picking up the @Primary datasource. Is there a way I can change this? As in the post mentioned above I am setting the engine datasource successfully using the following code is there a way for me to configure the Modeler datasource in code:

@Bean
    public EngineConfigurationConfigurer<SpringAppEngineConfiguration> engineConfigurer()
    {
        return configuration ->
        {
            configuration.setDataSource(dataSource);
            configuration.setTransactionManager(transactionManager);          configuration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
        };
    }

I guess the alternative is that I move the UI into a different spring boot app, or run it in docker or something, but I like the idea of having everything in the same place, unless you can advise me that that is the wrong strategy.

Thanks in advance for any help you can offer, and thank you for this resource, it has been invaluable!

Hello @mfarewell,

I don’t know the solution for your problem but may I ask how could you solve this different schema thing? I have created my own schema other than default public one and I can see that flowable creates its tables in that schema. But public schema -which my business logic uses- throws errors like “could not execute statement” or “relation ‘blabla’ does not exist” etc. All I did was add these to the yml

flowable:
database-schema: flowable
database-schema-update: true

Like I said, I can see that tables created in flowable and public schemas but for some reason I get errors. Do you have any idea what could be the issue?

Thanks

When you say that that you get errors “relation ‘blabla’ does not exist” are the errors relating to your own business tables or are they flowable ones? If it your own then I did find this when flowable took over as the primary database, meaning my own business logic was looking in the wrong schema.

If you follow the article Spring Boot integration with a differnet database - #2 by fiki574 and put the 2 connection strings in the yaml then it should work. In postgres you can set the current schema on the flowable database string e.g.

jdbc:postgresql://127.0.0.1:5432/mybusinessdb?currentSchema=flowable

I cannot find any mention of the property you have of flowable.database-schema: flowable, where did you get this from?

I never did solve my problem, spent week hunting, and worked around it and accepted some flowable tables in my public schema.

They were related to my business tables but I figured it out yesterday. I set schema to “public” explicitly in all my business entities and that solved my problem.

@Table(name = "blabla", schema = "public")

I cannot find any mention of the property you have of flowable.database-schema: flowable, where did you get this from?

I couldn’t find where I have seen this but will let you know if I find it.

Also let me know if you have any questions because right now I don’t have any problem regarding creation of flowable ui tables in public.

I have just come back to this project and I can confirm that setting

flowable:
database-schema: flowable
database-schema-update: true

Worked a treat and I no longer have any issue with my public database having flowable tables.
Many thanks!

Mike

2 Likes