1 Reply Latest reply on Aug 6, 2002 1:42 PM by Dain Sundstrom

    ejbStore called after findByPrimaryKey

    Martin Kuhn Newbie


      I'm working with JBoss 3.0 and CMP.

      Why is ejbStore called twice after a
      simple findByPrimaryKey?

      Please, can anybody explain it??


        • 1. Re: ejbStore called after findByPrimaryKey
          Dain Sundstrom Master

          It is called before findByPrimaryKey because the ejb specification requires a full synchronization before executing a finder, and it is called after because you may have modified your object between the finder and the end of your code.

          You may have modified a local variable in the findByPrimaryKey and then in ejbStore you could store that variable in a persistenct field.

          Don't worry about optimizing away the ejbStore methods. They normaly don't do anything so HotSpot just wipes them out. In the JBossCMP implemnentation I assure that all of the callbacks are respected, so users don't get wierd states.

          If you run a profiler and prove that this method is really an serious preformance hit to the server, I consider an optimization.