Activiti ( version 5.6 at the time of writing this ) does not support using fully qualified table names for it’s persistence layer (i.e. prefixing tables with a SCHEMA. value)
Our company has a standard where the application server user name setup in the datasource is different than the owning schema. For example, the activity tables and application tables are in schema X but the application user is X_APP_USER. Activiti ends up creating and using the tables in X_APP_USER but we want to be able to have them created and used in X.
There are a couple of ways to do this that we’ve determined. 1) setup a login trigger for the Oracle user to call ALTER SESSION SET CURRENT_SCHEMA=X 2) write a DataSource wrapper that calls ALTER SESSION SET CURRENT_SCHEMA=X upon ‘getConnection’ (this works and is implemented) 3) alter Activiti to support schema prefixes (hence this jira issue). 4) add synonyms to X_APP_USER (doesn’t work if tables are initially created)
Shown below is the implementation of #2.
So, while working with Activiti, we noticed that Activiti was redeploying bpmn files EVERY TIME the server restarted even though the files never changed. Since there are two servers, the number of deployed processes was increasing rapidly (many restarts during development). Ultimately, this is due to a comparison between an existing deployment in the database and the new deployment. A byte by byte comparison is done with ‘supposedly’ the latest deployment in the db and the potential process to deploy.
This issue however, is that the map files used have their SQL setup to sort by deployment date ascending and then pull the first one by key. This returns the OLDEST deployment, not the NEWEST deployment which is what Activiti should be using for comparison.
The result is that if you deploy x.bpmn20.xml and then change it, from that point forward it will ALWAYS redeploy. This is an issue with not only spring automatic deployment but any deployment where it’s comparing the newest vs the potential deployable.
In order to fix this without patching the software and waiting for a release, we extended the DeploymentManager that came with Activiti and overrode the findLatestDeploymentByName. This was very easy to do and has fixed the issue. The code is below.