0 Replies Latest reply on Sep 28, 2007 5:47 AM by Jamie Cruise

    Data separation in a multi-tenant application

    Jamie Cruise Newbie

      I am trying to implement multiple db support from a single web app. This bascially involves allowing the users to select their db on login. I have an ok strategy for switching the main app db. I simply define multiple entityManagerFactories and then use an expression for the entityManager component's entityManagerFactory attribute.

      However, I also need to switch the Jbpm database.

      My current best idea for how to do this involves changing the seam org.jboss.seam.bpm.jbpm component to allow it to select a specific jbpm configuration at runtime, depending on the value of an expression.

      The underlying JbpmConfiguration class does support multiple configuration instances (e.g. JbpmConfiguration.getInstance("myjbpm.cfg.xml")) but the Seam component is application scoped and caches a single configuration instance for it's lifetime.

      Unfortunately I can't replace this component with one of my own because it's referenced directly by the org.jboss.seam.bpm.jbpmContext class. I can't just replace this as well because it is referenced directly by just about every other Seam bpm component. Sigh.

      I think that my best bet is to patch the Seam Jbpm component to support multiple configs.

      Would this patch likely be accepted into the main codebase?

      Does anyone have a better solution?