0 Replies Latest reply on Jan 1, 2002 7:12 PM by garyg

    correct way to use isDirty / isModified flags

    garyg

      I'd like to know what the correct way to use some sort of isModified() method would be (not that I've found a method called isModified(), but I hear of it alot).

      I have a client that needs to tell an ejb (bmp) to change the value of one of it's instance variables and update it in the dbase, so I have it call ...

      myHome.setState(state);

      So now I'd like to know how to tell the container that this var has changed and that it should only update into the database those vars that have changed. So is something like this the correct way to do it ...

      setState(int val) {
      stateIsDirty = true;
      this.state = val;
      }

      ejbStore() {
      if (stateIsDirty) {
      ... do SQL UPDATE stmt's here
      }
      if (otherValIsDirty) {
      ...
      }

      ...
      }

      Note: I've had to change my commit-options in standardjboss.xml to B in order to get it to call ejbLoad when needed, so not sure if this has any effect here (except that ejbLoad and ejbStore seem to get called forever at times).

      Any help much appreciated.