7 Replies Latest reply: Sep 29, 2013 2:22 AM by Timo Hahn RSS

    How to find only modified attributes in an Entity

    user13159000

      Hello,

       

      I am using Jdev 11.1.1.6

      Here is my requirement, I have an entity with around 50 attributes, There is a updtable view object based on this entity, This view object dragged onto page as updatable af:table component. User may modify any value on the screen, by clicking on Save button, I need to find out what are all the rows has been modified, and I just need only specific modified attribute names and corresponding old value.

       

      I have used below method,  but I can't hard code 50 attributes to find out whether modified or not..

       

      What is the best approach to find out only modified attributes and corresponding old values as well

       

       

          @Override

          protected void doDML(int i, TransactionEvent transactionEvent) {

              byte state = this.getEntityState();

              if (state == this.STATUS_MODIFIED) {

                  System.out.println(this.getEmployeeId().toString() +

                                     " Has been Modified ");

                  //Object[] modifiedAttributes =this.getAttributeNames();

                  if (this.isAttributeChanged("FirstName")) {

                      System.out.println(" FirstName Modified");

                  }

                  if (this.isAttributeChanged("LastName")) {

                      System.out.println(" FirstName Modified");

                  }

       

       

              }

              super.doDML(i, transactionEvent);

          }