Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-2942

springprocessengine does not use the sessionfactory name supplied in the cfg.xml file to get the LocalSessionFactoryBean

    XMLWordPrintable

Details

    • Low
    • Hide

      Have 2 sessionfactories in the same context, and have the 2nd one be the JBPM sessionfactory. The db checks will fail in that case.

      Show
      Have 2 sessionfactories in the same context, and have the 2nd one be the JBPM sessionfactory. The db checks will fail in that case.

    Description

      It is possible to specify the factory name to be used by JBPM when using the spring integration via springhelper.
      This is done via:

      jbpm.tx.spring.cfg.xml
        <transaction-context>
          <transaction type="spring" />
          <hibernate-session current="true" factory="sessionFactory"/>
        </transaction-context>
      

      However when the processengine is constructed, this name is not used, and a type search in the application context is done instead:

      SpringProcessEngine.java
          if (configuration.isInstantiatedFromSpring()) {
            applicationContext = (ApplicationContext) configuration.getApplicationContext();
      
            springProcessEngine = new SpringProcessEngine();
            springProcessEngine.applicationContext = applicationContext;
            springProcessEngine.initializeProcessEngine(configuration);
      
            LocalSessionFactoryBean localSessionFactoryBean = springProcessEngine.get(LocalSessionFactoryBean.class); // WRONG...
            //...
         }
      

      This code above is only used during init to run db checks I think. However when multiple session factories are available, this code may end up using the wrong LSFB:

      Multiple beans for type class org.springframework.orm.hibernate3.LocalSessionFactoryBean found. Returning the first result.
      

      SpringProcessEngine should used the name in the XML, or (less desirable) use a spring-supplied name (via springhelper property?).

      Attachments

        Activity

          People

            Unassigned Unassigned
            bruyeron Renaud Bruyeron (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: