5 Replies Latest reply on Apr 17, 2007 8:18 PM by pjodev

    Problem Creating ProcessInstance

    mchicote

      Hi, the code is like this:

       JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
       ProcessInstance instance = jbpmContext.newProcessInstance("DefinitionName");
       jbpmContext.close();
      


      When it inserts the first ProcessInstance (first in the table, id = 1) it runs fine.
      When I tried to insert a second ProcessInstance it fails:

      Hibernate:
       insert
       into
       JBPM_PROCESSINSTANCE
       (VERSION_, KEY_, START_, END_, ISSUSPENDED_, PROCESSDEFINITION_, ROOTTOKEN_, SUPERPROCESSTOKEN_)
       values
       (?, ?, ?, ?, ?, ?, ?, ?) select
       scope_identity()
      14:56:33,140 [main] WARN JDBCExceptionReporter : SQL Error: 2627, SQLState: 23000
      14:56:33,140 [main] ERROR JDBCExceptionReporter : [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Violation of UNIQUE KEY constraint 'UQ__JBPM_PROCESSINST__731B1205'. Cannot insert duplicate key in object 'JBPM_PROCESSINSTANCE'.
      14:56:33,140 [main] WARN JDBCExceptionReporter : SQL Error: 3621, SQLState: HY000
      14:56:33,140 [main] ERROR JDBCExceptionReporter : [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]The statement has been terminated.
      Exception in thread "main" org.jbpm.persistence.JbpmPersistenceException: couldn't assign id to org.jbpm.graph.exe.ProcessInstance@16de067
      


      Violation of unique key constrain? In JBPM_PROCESSINSTANCE table the id has identity "yes" (autonumeric), in the hibernate entity configuration file for ProcessInstance the id is "native", even in the executed sql there's no ID for insert. So, what's happening? It should insert a row with id=2 but it says that the id is duplicated.

      Thanks!



        • 1. Re: Problem Creating ProcessInstance
          zipwow

          I'm having the same issue, but my reading of it is that it's the unique constraint on the combination of processdefinition_ and key_ fields.

          I don't get this behavior on hypersonic, but I do when I run against my Oracle database.

          • 2. Re: Problem Creating ProcessInstance
            zipwow

            I created a JIRA entry on what I'm seeing:
            http://jira.jboss.com/jira/browse/JBPM-913

            I removed the unique constraint on key_ and processdefinition_, and that fixed up my problem. I haven't done enough testing to confirm that it doesn't *cause* other problems, however.

            -Kevin

            • 3. Re: Problem Creating ProcessInstance
              mchicote

               

              "zipwow" wrote:
              I created a JIRA entry on what I'm seeing:
              http://jira.jboss.com/jira/browse/JBPM-913

              I removed the unique constraint on key_ and processdefinition_, and that fixed up my problem. I haven't done enough testing to confirm that it doesn't *cause* other problems, however.

              -Kevin


              k thanks, i'll try removing the constraint for a temporary solution.
              any official word about this?

              • 4. Re: Problem Creating ProcessInstance
                zipwow

                I'd watch the JIRA for more details. Right now it says:

                The main issue here is that most databases (including mysql and oracle) do not index null values (if you think about it, you'll see why). The appropriate workaround for your case is probably to replace the unique constraint with a standard index on (KEY_, PROCESSDEFINITION_).

                The permanent fix is under discussion.


                • 5. Re: Problem Creating ProcessInstance
                  pjodev

                  were either of you ever able to get this to work with MSSQL 2000 ?

                  I keep getting errors that it is a duplicate processID OR that it is trying to insert "Null" into the processID field