6 Replies Latest reply on Apr 8, 2007 11:47 PM by Ian Timothy

    Changes don't commit on the database

    asd asd Newbie

      Hi all
      I'm facing a really cumbersome problem. in my program I create a new process definition and deploy it, and then I use the process definition to create a process instance, which I save it later. the program works will, but nothing changes in the database, all tables have 0 rows. I'd be glad if anybody could help me.
      Thanks in advance.

        • 1. Re: Changes don't commit on the database
          Ronald van Kuijk Master

          please don't expect us to be clairvoyant

          • 2. Re: Changes don't commit on the database
            asd asd Newbie

            >please don't expect us to be clairvoyant

            Plz don't be satirical. If you found that my description is not sufficient tell me.
            All what I want to say are the following: normal procedures that causes a change in the database, don't cause any change at all, i.e. if I create a ProcessDefinition and deploy it, I should navigate to JBPM_PROCESSDEFINITION table to find that it has 1 new row, I found that it contains 0 rows.
            What makes me not to describe the details of the problem, is that I'm new to JBPM, and i think that a lot of you have faced this problem before.

            • 3. Re: Changes don't commit on the database
              David Lloyd Master

              You probably aren't closing your jbpm context, or not committing the database transaction.

              • 4. Re: Changes don't commit on the database
                asd asd Newbie

                I wonder if I should close the context after every context?, If I should how could I open it again?
                Regards
                Remon

                • 5. Re: Changes don't commit on the database
                  asd asd Newbie

                  I'll be grateful if any body could help me

                  • 6. Re: Changes don't commit on the database
                    Ian Timothy Newbie

                    Hello.

                    I'm guessing that somewhere in your code, you should be having these lines:

                    JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
                    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();

                    // Your code below these lines...

                    I think what you could try doing is put the above two lines inside a try block, catch any exceptions and then finally close the context i.e.

                    try{
                    JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
                    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
                    //your code...
                    }
                    catch(Exception e){
                    throw e;
                    }
                    finally{
                    jbpmContext.close();
                    }

                    I think it is good practice to close the context each time you create a new one in a method to ensure what you are doing persists.

                    Sometimes the method that you are writing needs to do call other methods which require the use of a JbpmContext. Instead of creating a new JbpmContext in those other methods, you could pass the first JbpmContext created to them.

                    I have also just started using Jbpm, but so far this seems to work for me. If I have said anything wrong, maybe the seniors in this forum could add to it or correct it.

                    Hopefully, your problem will be solved soon. Take care.