5 Replies Latest reply: Sep 30, 2013 2:33 AM by Timo Hahn RSS

    keep original data in VO, change view data

    newbee

      Hi .

      how can i keep originial data in table component that created based  on DataBase view (there is not Entity Object in ADF. there is only VO) .

      describe :

      user can change data and developer must do DML function for each change ,

         1-   maybe user clear a field so field will be cleared and when user press commit button a row in another database table will delete , it means

         user see clearing of field on page but delete a row is occured in database . !

       

          2- maybe user want to UNDO change , so i need to its original value .

       

      therefore have any soloution for these problems ?

       

      thanks


        • 1. Re: keep original data in VO, change view data
          Timo Hahn

          User, again, please provide your jdev version with your question!

           

          1) A VO which is not based on a EO can't be changed and you will not get an input form for a row for it.

          2) once the data is removed and committed it's gone. You would need to store each change to the data of a row in a new row distinguished by a date from each other. Then you can go back to every state in time.

           

          Timo

          • 2. Re: keep original data in VO, change view data
            newbee

            Hi Timo and thanks alot .

            my JDEV version is 11.1.1.7 .

            Dear Timo,  i cant speak english very well so maybe i cant say my purpose as well as you .

            now i write what user expects

            once the data is removed and committed it's gone. its OK . but ...

               client wants i add a popup to all field and when he select undo from filed`s popup ,

               value of field resets to original value. for example at first time that page loaded

               amount = 100    then user changed it to 150

               NOW he want right click on field and select undo change , and he expects at this time amount

                resets to 100 same as first time .

                 
            thanks again

            • 3. Re: keep original data in VO, change view data
              Timo Hahn

              Assuming your VO is based on an EO you can implement a service method in the VO which gets the last committed value of an attribute back. This method you call if the user wants to undo a not committed change.

              The method of VO accepts the  name of attribute (or the index) and return the last postet attribute. The way to get in the EntityImpl as

              protected  java.lang.Object getPostedAttribute(int index)

                        Gets the value originally read for this attribute from the database.

              Timo

              • 4. Re: keep original data in VO, change view data
                newbee

                thanks Timo for your help & attention

                "Assuming your VO is based on an EO" ....

                my manager dosn`t permit to create VO based on an EO ...

                 

                At last i think about this soloution :

                • create a ReadOnly VO and in its Query for "amount" i select twice amount with separate name(amount and amountOriginal).benefit of this act is keep

                         original data always separate in another field that dosnt change any time so i have original value.    

                • set updateable attribute for amount to Always .(however VO is read only but on page can change fields)
                • on page whenever user needs to reset value of amount , i copy value of amountOriginal to amount .
                • finally simulate commit button . when user press a button for save his changes i iterate VO and decide about which function in database must call .

                 

                NOW my ask is :

                  is my solution implementable ? is it good or bad solution ?

                 

                 

                thanks

                • 5. Re: keep original data in VO, change view data
                  Timo Hahn

                  You can try to implement this. Not sure which problems you are running into as you are fighting the framework and have to cope with the framework fighting back.

                   

                  How are you supposed to write the changed data back to the db and when?

                  Whatever you do, if you are using adf business components using an VO based on an EO is the best solution.

                   

                  Timo