2 Replies Latest reply on Nov 9, 2007 8:34 AM by Albrecht Olivier

    Did any one use springmodules to integrate jbpm with spring?

    Calvin Lee Newbie

      when using spingmodules, i have got the object of JbpmTemplate, but

      ProcessInstance p =jbpmTemplate.findProcessInstance(1L);
      System.out.println("----"+p.getId());

      it throws org.hibernate.LazyInitializationException,
      -----
      ERROR [org.hibernate.LazyInitializationException] - <could not initialize proxy - the owning Session was closed>
      org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
      at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:60)
      at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
      at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:150)
      at org.jbpm.graph.exe.ProcessInstance$$EnhancerByCGLIB$$5d7ec21a.toString()
      ------------------
      because in jbpmTemplate, it close the JbpmConxtex after the operation, and of course the session, but hibernate3 is lazy-initilization default :(
      how to solve this problem?

        • 1. Re: Did any one use springmodules to integrate jbpm with spr
          Heiner Niehues Newbie

          I dont know exactly what you mean with springmodules.
          I am using the jbpm with the Springframework, Tomcat and JSP.
          Why the session get closed when you close the JbpmContext.
          Post more code of you Spring implementation enviroment ?



          • 2. Re: Did any one use springmodules to integrate jbpm with spr
            Albrecht Olivier Newbie

            Your Hibernate session is closed ... it is a Spring configuration pb, not a JBPM problem ...

            In your spring_applicationcontext, you need to declare a Transactionnal service. The transactionnal service is there to do the hibernate proxy and give transactions when needed.
            Your object (for exemple facadeService here) where your code is written on use the transactionnal Service to get Hibernate Transaction

            Then every methode written in your object will use a Hibernate transaction and then the hibernate session ....

            <bean id="transactionalService"
             class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
             abstract="true">
             <property name="transactionManager">
             <ref bean="transactionManager" />
             </property>
             <property name="transactionAttributes">
             <props>
             <prop key="*">PROPAGATION_REQUIRED</prop>
             </props>
             </property>
             </bean>
            
             <bean id="facadeService" parent="transactionalService">
             <property name="target">
             <bean
             class="ocd.common.workflow.facade.FacadeOCD">
             <property name="jbpmConfiguration">
             <ref bean="jbpmConfiguration" />
             </property>
             </bean>
             </property>
             </bean>
            
            


            Olivier