13 Replies Latest reply on Jan 17, 2007 5:43 AM by Ronald van Kuijk

    douplicate process definitions after redeploy

    Thorsten Kunz Novice

      Hi I am new to jBPM so this may be a stupid question but I did not find the answer to it in the docs:
      I plan on useing jBPM together with seam and I have put everything into a ejb3 archive. For persistance I made jBPM use mysql. Everything works fine, tables are created and populated with my process definition when I deploy the ejb3 archive
      The only thing is that when I redeploy the ejb3 archive because I had to change something unrelated to the processes or when I have to restart JBoss AS for some reason the entire workflow es being put into the tables again. Same name, same version (-1), same everything (keys and references are different of course). Is there a way to avoid that a process is inserted a second time if nothing has changed that would affect the proccesses?
      update is in my hibernate.cfg.xml so that an instanced process would survive a redeploy.
      Is this a bug or an intended behavior?

      Thanks for your help

        • 1. Re: douplicate process definitions after redeploy
          Thorsten Kunz Novice

           

          "SunFire" wrote:
          <property name="hibernate.hbm2ddl.auto">update</property> is in my hibernate.cfg.xml so that an instanced process would survive a redeploy.

          <property name="hibernate.hbm2ddl.auto">update</property>
          that is ;)

          • 2. Re: douplicate process definitions after redeploy
            Koen Aers Master

            It is not necessary to specify this property for the running instances to survive a redeploy. They survive automatically.

            Regards,
            Koen

            • 3. Re: douplicate process definitions after redeploy
              Thorsten Kunz Novice

               

              "koen.aers@jboss.com" wrote:
              It is not necessary to specify this property for the running instances to survive a redeploy. They survive automatically.

              If I don't set hibernate.hbm2ddl.auto at all I am getting
              15:40:57,828 WARN [JDBCExceptionReporter] SQL Error: 1146, SQLState: 42S02
              15:40:57,828 ERROR [JDBCExceptionReporter] Table 'test.jbpm_processdefinition' doesn't exist
              15:40:57,828 INFO [STDOUT] org.hibernate.exception.SQLGrammarException: could not insert: [org.jbpm.graph.def.ProcessDefinition]

              And if I set it to create-drop all jbpm tables are being dropped if I redeploy my ejb3 with the processes in them.
              And finaly if set to "update" it creates a new additional process definition for every redeploy of the ejb3.
              So how does jBPM persist already started workflows if not in the tables? I start to think that I may have missed some fundamental part of the whole jBPM idea? :(

              Thanks

              • 4. Re: douplicate process definitions after redeploy
                Koen Aers Master

                You have to use update. jBPM will increment the version numbers of any process with the same name as the one being redeployed. Instances that are already running will continue to run in the vesion they were started from, new instances will run in the newly deployed version.

                Regards,
                Koen

                • 5. Re: douplicate process definitions after redeploy
                  Jack Cox Newbie

                  I don't think the question was answered, so I'll restate it.

                  Each time the application deploys inside the J2EE container, jBPM is creating new definitions of the same process. This leads to much database bloat if you've got more than a few non-trivial business processes.

                  The hibernate.hbm2ddl.auto=update setting controls the creation of the tables in which the workflows are defined.

                  The question is how do we as jBPM users keep jBPM from redefining the workflow each time the container restarts or redeploys? It is not a hibernate issue since we can control when hibernate recreates or updates the tables, but is a jBPM deployment issue to keep it from continuing defining new processes that are not necessary.

                  Thanks,

                  Jack

                  • 6. Re: douplicate process definitions after redeploy
                    Ronald van Kuijk Master

                    jBPM by itself does not deploy anything. If procesessdefinitions are redeployed that might be because seam does it that way (if you use seam). I did not use seam with jBPM yet and never experienced anything like this.

                    • 7. Re: douplicate process definitions after redeploy
                      Jack Cox Newbie

                      You are correct about it being a Seam thing, because this is occurring within a seam environment. My understanding is that in a vanilla jBPM environment, the application must deploy the workflows in code.

                      Where as with Seam the workflows are automatically deployed when the application starts (or restarts).

                      • 8. Re: douplicate process definitions after redeploy
                        Ronald van Kuijk Master

                        > vanilla jBPM....

                        Or via the designer or some other 'process'...

                        • 9. Re: douplicate process definitions after redeploy
                          Koen Aers Master

                          If SEAM is redeploying the process definitions when starting the applications, then probably you should post the issue on their forum. Probably they should have a mechanism preventing redeployment.

                          Regards,
                          Koen

                          • 10. Re: douplicate process definitions after redeploy
                            Ronald van Kuijk Master

                            He already did.... and Norman said to whisper something in the jBPM forum. That is why I revived the versioning topic :-)

                            • 11. Re: douplicate process definitions after redeploy
                              Koen Aers Master

                              All right, so now we only need a solution... :-P

                              • 12. Re: douplicate process definitions after redeploy
                                Rabbia Qaswar Newbie

                                hello

                                i am using JBoss jboss-4.0.5 and i commented the default value of hibernate.hbm2ddl.auto = create in persistence.properties and set it in the persistence.xml file as hibernate.hbm2ddl.auto = update.

                                My tables already exist in the database. I dont want to to create new tables everytime the application is deployed on the JBoss. But now when i deploy my application on JBoss with the value of hibernate.hbm2ddl.auto set to 'update' i get the following exception:



                                09:54:18,483 WARN [JDBCExceptionReporter] SQL Error: 1031, SQLState: 42000
                                09:54:18,483 ERROR [JDBCExceptionReporter] ORA-01031: insufficient privileges
                                
                                09:54:18,483 ERROR [SchemaUpdate] could not complete schema update
                                org.hibernate.exception.SQLGrammarException: could not get table metadata: CUSTOMERS
                                 at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
                                 at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
                                 at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
                                 at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(DatabaseMetadata.java:100)
                                 at org.hibernate.cfg.Configuration.generateSchemaUpdateScript(Configuration.java:878)
                                 at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:140)
                                 at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:314)
                                 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1218)
                                 at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:688)
                                 at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.
                                java:127)
                                 at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
                                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                 at java.lang.reflect.Method.invoke(Method.java:585)
                                
                                
                                


                                Please help!

                                • 13. Re: douplicate process definitions after redeploy
                                  Ronald van Kuijk Master

                                  Wrong forum... ask in the hibernate forum...