2 Replies Latest reply on Jul 29, 2008 11:29 AM by Milan Agatonovic

    org.hibernate.HibernateException: null index column for coll

    Milan Agatonovic Newbie

      Hi,
      to be honest, I do not know why i am posting question on this forum, since I am the one who only answers on them, and I really do not think I will have an answer on this one :)
      It seems, I feel really desperate :(
      So the problem is the following:
      I am using Jbpm-jpdl-3.2.3, hibernate 3.2.5, latest spring modules and basically use JBPM with Spring, passing the existing sessionFactory to jbpmContext.
      Everything works fine within JUnit test cases (I extend AbstractTransactionalDataSourceSpringContextTests and at the end of each test method, I call setComplete() in order to commit in DB instead of default rollback.
      But the same methods. e.g deploy/undeployProcessDefinition with the same process definition do not work under tomcat.
      For example: method undeployProcessDefinition results in

      org.hibernate.HibernateException: null index column for collection: org.jbpm.graph.def.ProcessDefinition.nodes
      

      And, by looking in DB, after executed method deployProcessDefinition, it is not wonder, since the field:
      NODECOLLECTIONINDEX_ in JBPM_NODE table is NULL for every node record.
      Just to note, when invoked the same method within JUnit the NODECOLLECTIONINDEX_ is NOT NULL.

      I read user manual several times, along with the most JIRA issues, (no wonder since I am working with JBPM very long time).
      Can somebody, possibly can have a clue what can be the reason for this?
      Btw, I read Bernd's JIRA issue about the same exception when using JtaPersistenceServicefactory, but then he said that it was because of the wrong conf.

      It is definitely not my case, at least extensive debug messages confirm that everything is initialised properly. I even compared the initialisation code in both cases (junit and tomcat) and everything looks just the same and without any problem.

      NOTE: since I am using JBPM with spring and within a big enterprise application, I am not able to send short Unit test, that someone can try locally.


      Thanks a lot for every hint.
      Milan

        • 1. Re: org.hibernate.HibernateException: null index column for
          Ronald van Kuijk Master

           

          to be honest, I do not know why i am posting question on this forum, since I am the one who only answers on them, and I really do not think I will have an answer on this one :)

          Sorry, but that might have to do with how questions are posed, what info is provided etc...

          - do you use spring jBPM template? if so, ditch it (not spring, just this template, it's officially only for 3.1.x afaik)
          - Do both the junit and tomcat use spring?
          - Same jbpm config? (not e.g. one without and one with transactions configured)
          - same transactionmanager?
          - same transactionmanager config?
          - if you cut spring out of it (for this specific situation) does it work then?

          NOTE: since I am using JBPM with spring and within a big enterprise application, I am not able to send short Unit test, that someone can try locally.


          Hmm...... strange.... Does this mean you have very few big classes that do a lot of work?

          • 2. Re: org.hibernate.HibernateException: null index column for
            Milan Agatonovic Newbie

            Hello Ronald, thanks for the reply.
            I managed to resolve the problem.
            I am answering to your questions below, in case somebody else is also trying to use JBPM inside Appfuse.


            - do you use spring jBPM template? if so, ditch it (not spring, just this template, it's officially only for 3.1.x afaik)

            Yes, I do. Actually I extend JbpmTemplate from spring modules and it works very well, so for now I do not plan to ditch it.

            - Do both the junit and tomcat use spring?

            Yes. I am extending AbstractTransactionalDataSourceSpringContextTests in my test classes (one for each process definition). Every method ends with explicit setComplete() call in order to do actual insert in DB. I need that for async exec and callbacks.

            - Same jbpm config? (not e.g. one without and one with transactions configured)

            Yes, the same jbpmConfig, defined in spring applicationContext.xml (slightly modified spring-modules LocalJbpmConfigurationFactoryBean), loaded by StartupListener and Base Junit test class.

            - same transactionmanager?
            - same transactionmanager config?

            Well, this was the trick. Transactions are declared through AOP originally in appfuse, and I moved my WorkflowManager in another module. That caused all JBPM calls to be outside the transaction. In Junit test the transactions are provided by Spring base Junit test class, so there were no problems.
            Btw, I defined a custom DbPersistenceServicefactory, since I had to extend GraphSession and TaskMgmtSession.
             <service name="persistence">
             <factory>
             <bean class="gleam.executive.workflow.core.JbpmDbPersistenceServiceFactory">
             <field name="isTransactionEnabled"><false /></field>
             </bean>
             </factory>
             </service>
            

            This seems to work well.


            Does this mean you have very few big classes that do a lot of work?

            No, it means that my Junit test are spring dependent. Also, they include some utility classes, since they perform complete process definition tests according to all possible scenarios.

            Cheers,
            milan