8 Replies Latest reply on Feb 10, 2009 10:49 AM by deanhiller2000

    bypass updates with s:button?

    deanhiller2000

      I have a cancel button but the values are still being applied to the bean and since the bean came from the database, once the conversation is finished, the changes are saved to the database even though the user clicked cancel!!!


      this is a very complicated situation actually....it is a long wizard such that we actually have save and continue buttons as well but the user might cancel out of something and then hit save and continue to save some of the other stuff.


      How do I make sure cancel does not apply the bean?  I am hoping I don't have to write a proxy bean for every page and only copy that beans values over to the EJB on hitting the ok/next buttons...that would be ALOT of work for the amount of pages we have. 
      thanks,
      Dean


        • 1. Re: bypass updates with s:button?
          nickarls

          Are nested conversation and/or manual flush mode applicable?

          • 2. Re: bypass updates with s:button?
            deanhiller2000

            today, we are using mgr.flush during the long long conversation....the problem is not saving what was changed in the EJB....I am not sure nested conversation works or not though.


            Question: a nested conversation ends the parent conversation when I close it, correct? that tends to screw me up then.  If I could do a nested conversation though and save or cancel out of it without killing the parent conversation, that would work great but I read the parent conversation is killed before I thought when child is closed???



            • 3. Re: bypass updates with s:button?
              deanhiller2000

              I just realized on cancel I could leave the nested conversation dangling so is there a way to get out of the nested conversation?  In this fashion, the nested conversation would just timeout and the beans would never be changed(or so I assume)....thoughts?
              Dean

              • 4. Re: bypass updates with s:button?
                nickarls

                Hmm. Haven't used nested conversations that much but if closing a nested conversation would end the parent conversation it wouldn't be very useful(?)

                • 5. Re: bypass updates with s:button?
                  deanhiller2000

                  I think it is still very useful...it is like if you pick a hotel(starts a conversation), then pick a 2 rooms(each in it's own tab from parent)....once done picking a room, you flush the nested conversation and close it which closes the parent and all other children.  That is still a very useful concept I think and the problem is as a user I wanted the parent flushed and the room booked but what to do with the other nested children....they basically say they timed out if you try to use them.


                  Not sure if there was a better way the seam team could have done it to be honest.  I think it is quite good.


                  Dean

                  • 6. Re: bypass updates with s:button?
                    deanhiller2000

                    oops, realized I was not clear on one point....each room was a nested conversation so if you changed the state of the room, they would not collide with state info...as if both rooms used the parent conversation, you would get into trouble ;).


                    it is just for that specific scenario though and I am almost misusing it probably but I think I could use it this way to solve my problem.
                    later,
                    Dean

                    • 7. Re: bypass updates with s:button?
                      buckmin.erdem.agaoglu.gmail.com

                      Possibly you've tried that already but, entityManager.refresh should work in cancelling operation because reference states



                      Refresh the state of the instance from the database, overwriting changes made to the entity, if any.

                      Or i got it completely wrong

                      • 8. Re: bypass updates with s:button?
                        deanhiller2000

                        that's quite INTERESTING!!! thanks for the tip.  I might try that as well.
                        THANKS!
                        Dean