1 Reply Latest reply on May 10, 2011 4:16 AM by Samrat Roy

    jbpm 4.4 and Spring 3.0.5 integration

    Ayusman Dikshit Newbie

      Hi all,

       

      does anybody have a clear tutorials/instructions for integrating jbpm 4.4 and Spring 3.0.5?

       

      Any pointers will be helpful.

      Thanks.

        • 1. Re: jbpm 4.4 and Spring 3.0.5 integration
          Samrat Roy Newbie

          I have done a Jbpm 4.4 Spring 3.0.5 integration in a webapp.. So I am your man .. believe me it is tricky..

           

          Before you start to integrate stuff you need couple of files ready .

           

          I am assuming you are using hibernate .. because jbpm itself uses hibernate for data persistance..  (The version to use will be 3.5 , 3.6 wont work )

           

          1. jbpm.cfg.xml  - check atttachment - default attached. Keep it in the src directory of your project.

           

          2. jbpm.hibernate.cfg.xml - See attached,  again keep it int the src directory (notice the custom written hibernate dialect , for some reason hibernate was messing up type mappings for oracle 10g in my case) , jbpm.hibernate.cfg.xml file is auto picked by the jbpm api (check jbpm.tx.hibernate.cfg.xml - this file includes jbpm.hibernate.cfg.xml , so jbpm.tx.hibernate.cfg.xml had to be included in jbpm.cfg.xml ), hence no need to mention jbpm.hibernate.cfg.xml in any cfg files you create.

           

          3. jbpm4-context.xml - See attached,  again keep it in the src directory

           

          4. Create your normal hibernate.cfg.xml to do application specific db operations.

           

          5. jbpm specific hibernate operations are kept in jbpm.hibernate.cfg.xml (mentioned in point number 2)

           

          6. Do the normal spring hibernate configuration ..

           

             add the following beans in applicationContext.xml

           

          <!-- norman spring hibernate intigration -->  

           

          <bean id="sessionFactory"

           

                  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

           

                  <!--<property name="dataSource" ref="dataSource" /> -->

           

                  <property name="dataSource" ref="jndiDataSource" />

           

           

           

                  <property name="configLocation">

           

                      <value>classpath:hibernate.cfg.xml</value>

           

                  </property>

           

                  <property name="configurationClass">

           

                      <value>org.hibernate.cfg.AnnotationConfiguration</value>

           

                  </property>

           

              </bean>

           

          <!--adding jbpm beans to the spring context-->

           

          <import resource="jbpm4-context.xml" />

           

          7. That is all folks .. whenever you need any jbpm service .. just ask the spring context for it

             {getBean("repositoryService");}