1 2 Previous Next 22 Replies Latest reply on Nov 17, 2006 5:21 PM by cwash Go to original post
      • 15. Re: how can I do optimistic locking with crud framework?
        gavin.king

        Actually change it to:

        @Begin
         public void beginEdit() {
         log.info("Conversation begun by beginEdit()");
         }


        (This is more elegant.)

        • 16. Re: how can I do optimistic locking with crud framework?
          gavin.king

          I have just tested this and it all works.

          All I did was:

          (1) Added a version attribute
          (2) set scope="conversation" on contactHome (actually I will make this the default scope for a Home)
          (3) put propagation="begin" on the Edit link.

          • 17. Re: how can I do optimistic locking with crud framework?
            gavin.king

            (4) put propagation="end" on all links in editContact.xhtml

            • 18. Re: how can I do optimistic locking with crud framework?

              Aha, that did it, and I get ... yay, an HTTP 500 .. but the right error on the console. I guess dealing gracefully with the exception means catching it in update() and company. Figuring out how to present a UI to merge changes should be an interesting project.

              I can't see anything in @Begin's javadoc that tells me about return values, and I assumed page actions had to return either null to proceed to the given view-id, or optionally return a new viewid. Should I should use s:commandLink if I need to defer to a page action instead? I'll eventually move my complex navigation requirements into jbpm, but it's nice to be able to hack it out with actions first.

              • 19. Re: how can I do optimistic locking with crud framework?
                gavin.king

                 

                /**
                * An empty outcome list is interpreted to mean any
                * outcome except for the null (redisplay) outcome.
                */
                String[] ifOutcome() default {};


                All actions are allowed to return void. And Seam treats void differently to null. Null means "problem with input, redisplay page".

                • 20. Re: how can I do optimistic locking with crud framework?
                  gavin.king

                  Ah, I forgot to add the exception handling I meant to add :-)

                  I'll do that now.

                  Thanks for making me look into this stuff. Its good to have someone validate the design and code.

                  • 21. Re: how can I do optimistic locking with crud framework?

                    I was going by the description of page actions in the seam docs, section 3.1.1


                    The page action method can return a JSF outcome. If the outcome is non-null, Seam will delegate to the defined JSF navigation rules and a different view may end up being rendered.


                    I took that to mean that a null outcome meant that it would proceed to the "default" view (the one it would land on without a page action).

                    At any rate, using the propagation parameter looks like a much cleaner way of doing it than blank page actions (though it's usually not a bad place to stick application-level audit log messages). Thanks for pointing it out (and for putting up with my endless questions). You rock my small self-centered universe :)





                    • 22. Re: how can I do optimistic locking with crud framework?
                      cwash

                       

                      "gavin.king@jboss.com" wrote:
                      I have just tested this and it all works.

                      All I did was:

                      (1) Added a version attribute
                      (2) set scope="conversation" on contactHome (actually I will make this the default scope for a Home)
                      (3) put propagation="begin" on the Edit link.


                      I'm going to try this out soon. Seems like a good candidate for a wiki "tip" and perhaps reference guide nugget.

                      1 2 Previous Next