2 Replies Latest reply on Dec 4, 2008 7:18 AM by firetruck

    Token lock issue

      I have an issue with locking a Token.

      When an action starts to execute inside a Node, I lock the token with the method lock() from the Token object. That's to avoid the use of it, while the action is executing.

      Then, in another part of my code, i try to verify if the token is locked. I do this:

      Token token= jbpmContext.loadToken(processInstance.getRootToken().getId());
       if(token.isLocked()){
       ...
       }
      


      My problem is that when I load the token to check if it is locked, I don't get the same object that I locked in the Node. Instead, the token seems to be reloaded from database, and when it happens, the value of isLocked is lost, because it is a transient attribute.

      How should I do to load the exactly same object that I had previously locked in the Node?

        • 1. Re: Token lock issue
          kukeltje

          Hmm... maybe turn on second level caching in hibernate? Not sure, just a guess

          • 2. Re: Token lock issue

            Hi kukeltje,

            Thanks for your suggestion. I tried that already. At least I think I did, I'm not an Hibernate expert.

            I set the following in Token.hbm.xml:

            <cache usage="read-write"/>


            And it didn't work. It still loads different tokens. Do you have other suggestions on configuring the hibernate cache?