3 Replies Latest reply on Oct 1, 2007 1:49 AM by bonf

    Intercept form data for versioning

    bonf

      I'm trying to build a application that stores changes in a simplified versioning table whenever a change is made. To do this I have a seperate versioncontrol table. To do this I have added a vcUpdate() function to the entityHome class, that stores the state in the versioning table before calling update:

      public String vcUpdate() {
       EntityManager vcEm = this.getEntityManager();
       VcRole vcRole = new VcRole(this.instance, false);
       vcEm.persist(vcRole);
       vcEm.flush();
       return this.update();
       }

      But this does not work, as the role I am trying to stored has been changed already. Is there a way to intercept the form data before it is stored? Obviously I don't want to save a copy every time somebody starts the editEntity page, as they might close the session without editing or just press cancel etc.
      Is there a better way, has anybody done this?