AnsweredAssumed Answered

Pre-database execution logic/tenant id questions

Question asked by daltonconley on Feb 18, 2014
Latest reply on Feb 25, 2014 by jbarrez
I'm trying to do some processing just before I make a database query (of any kind). Previously, I was using the mybatis interceptor plugin approach, where I would write an interceptor plugin on the ibatis Executor class. This didn't seem to catch everything that was happening with the database, specifically with the SpringTransactionInterceptor.

So, I've moved onto another possibility. What I'm actually trying to do is read a field off the potential database call, and make the call to a different datasource depending on what type of data is being queried/inserted. I'm wondering if this can be done with the "customPreCommandInterceptors" property in the process engine configuration? If not, does anyone have any idea of a point in which I can catch Activiti right before a database execution happens?

To get into more details, I'm using the latest version of Activiti, currently in development. I'm trying to take advantage of the "tenant id" column added to some of the tables. Specifically, I want records with tenant id "A" to be placed into database1, and records with tenant id "B" to be placed into database2.

Any help/suggestions on this would be appreciated. Is there a better approach to this?

Outcomes