0 Replies Latest reply on Dec 18, 2002 5:11 PM by Tim

    CMP Jboss 3.0.4 - ejbStore called after findXXX methods.

    Tim Newbie

      Why is ejbStore() being called even when bean has not changed?
      EJB Spec or no EJB spec this seems a bit strange!

      I have read previous thread "ejbStore called after findByPrimaryKey"
      and would like some clarification. It seams:

      1) ejbStore is called after findByPrimaryKey.
      2) ejbStore is called ( it seems ) after any findxxx method.

      This raises a question.


      Point 1.

      If you, for example, have a version field (or use xdoclet soft-locking
      option) the version field the version field is incremented in the
      ejbStore() method as

      setVersion(getVersion() + 1);

      Also I wanted to include a modified_time field in bean. Seems that ejbStore()
      forces this to really be a "last accessed time", not what I wanted.


      SetModified(new Date().getTime);

      is called even when the record "isn't modified"

      Point 2.

      If you have **any** field modification in the ejbStore() it seems it
      will be called heaps of times. Lets suppose we are doing a zip
      of a binary stream of data to store in a blob field.

      In my testing, No fields have changed yet ejbStore() is being called.

      This has a nasty side effect of wasting resource doing a zip when nothing
      has changed. Worse than that the version field is incremented on every find.


      It seams ejbStore() is not the place to do this sort of thing in CMP so
      where should this be done??