0 Replies Latest reply on May 17, 2008 6:57 PM by cardel.ka.jelinek.seznam.cz

    How can I store old value before update?

    cardel.ka.jelinek.seznam.cz

      I have some functionality that allows me to activate / deactivate user.


      I have User class


      public class User implements Serializable {
       private Boolean activated;
      
       public Boolean getActivated() {
              return activated;
          }
      
       public void setActivated(Boolean activated) {
              this.activated = activated;
          }
      }



      and home object for user (UserHome class)


      I would like to know, how can I store old (active/inactive) state of user, before somenone set it to active or inactive.


      For example:
      I am updating active user and setting it to inactive state. So I call UserHome.update() method to update this user and in this method I can read only new value of user state. I don´t know if user was before in active or in inactive state. I need to react only on changes of user state
      inactive to active and
      active to inactive.


      So I need to know in which state user was before update.


      I tried to set some help variable in UserHome class by calling help method before rendering view. This variable was setted right, but it was delete after I call update method.


      I think there exist some simple solution