4 Replies Latest reply on Sep 14, 2009 9:39 PM by tony.herstell1

    The real problems of using Seam...

    tony.herstell1

      Ok, I have been using Seam for years now.


      On a typical days programming I have to re-learn (aha.. there is a reason and I figure it out) and guess (this doesn't make sense but works) my way through the day.


      For example; today...


      It seems I can have


      @Out(required=true)
          private Mode mode;



      or


      @In(required=false) @Out(required=true)
          private User user;




      but not both.


      In the first step of a business process


      @Begin(pageflow="create_registration_details_pageflow")



      I set the mode and user


      this.mode = Mode.CREATE; 
      this.user = new User();
      



      The first page is displayed which fills in the user fields...


      When I click a button, then my jPDL goes for a decision step which actions a method then inside this method...


      IF I have


      @Stateful



      then using the debugger I can see Mode set correctly but User is null (till the next step when it magically appears back on the screen again!)


      if I use


      @Conversational



      Then I can see my User but mode is now null.


      If I use neither of the above then mode is null.


      Even if I don't use


      @Conversational



      Then by hitting the home button I can see the conversation (Is this correct as does the PDL create me a conversation for free?).


      Sigh!


      This is just typical of a days using Seam.


      Sometimes it does not make sense.


      Is jPDL conversational?.. do I add the annotation or not?
      Adding stateful makes Mode work.. but why? its not a seam component (just an enumeration in an interface) perhaps this is something to do with it.


      But why does using stateful now mean my seam name entity appears as null???


      On another note...


      What is even more infuriating is that now when I make a change to a .xhtml and refresh the page then what was instant is now not. I have to wait a random amount of time for the change to appear... something has brokem the hot-synch capability of MyEclipse (probably something to do with trying to get hot-deploy working with the Ant/Maven people). This is really annoying as I have to wonder if the cahnge has taken effect yet or not often I have to add a piece of text to the page to know when Seam has filtered the change through... Appauling state of affairs and really slowing me down.. at this rate progress will be so slow I might as well be using Ant!


      To be honest; it used to be a lot easier in the early days of seam.



      However if I compare this to what I see in the industry then I still would prefer to use Seam.


      I have seen companies put in the most awful hack imaginable to get software out of the door. I have seen (a few times) Spring/Hibernate projects flounder on LIEs until they simply put Lazy-false and fetch everything every time everywhere in desperation (so don't think Spring/Hibernate projects work that well or are scalable)


      I think the lack of support from the Seam guys is not becoming a real issue and would make me think twice about recommending Seam.


      I still think that Seam is the right choice.


      I wish someone would write a Seam for Idiots (Users!) book using JSF, PDL, BPM, EJB3, JPA (Seam Managed Transactions) on JBoss only (remove the clutter of all the options!).


      I also don't really believe or use SeamGen other than a marketing tool. I believe you must write your code to understand it better (at least initially).


      Err.. end rant!

        • 1. Re: The real problems of using Seam...
          yahawari

          nice summery :) .. totally agree !

          • 2. Re: The real problems of using Seam...
            tony.herstell1

            Ok, have gone found the cat, given that a good telling off (which it listened to intently and then ignored) and I feel much better.


            SINCE the Seam bean method worked... here was my solution


            Create a bean JUST for passing an enumeration around!





            public interface CRUDSMode {
            
                /**
                 * The mode that this Controller is currently being driven in.
                 */
                public enum Mode {CREATE, READ, UPDATE, DELETE, SEARCH};
            
            }






            @Local
            public interface CrudsController extends Serializable {
                 
                 public void setMode(Mode mode);
                 
                 public Mode getMode();
                
                 public void destroy();
            }





            @Name("risingstars.crudsController")
            @Stateful
            public class CrudsControllerImpl implements CrudsController, Serializable {
                 
                /**
                 * Inject and leverage the Seam Logger.
                 */
                @Logger
                private Log log;
                 
                 public Mode mode;
                 
                 public void setMode(Mode mode) {
                      this.mode = mode;
                 }
                 
                 public Mode getMode() {
                      return this.mode;
                 }
                
                 @Remove
                 @Destroy
                 @Override
                 public void destroy() {
                      log.info("> destory");
                      log.info("< destory");
                 }
            






                 /**
                  * Outject a mode of operation for pages to act on.
                  */
                @In(create=true) @Out(required=true)
                private CrudsController crudsController;





                 @Override
                 @Begin(pageflow="create_registration_details_pageflow")
                 public String createRegistrationDetails() {
                      log.info("> " + this.getClass().getName()+ " enter ");
                      crudsController.setMode(Mode.CREATE);
                      this.user = new User();
                      log.info("< " + this.getClass().getName()+ " enter ");
                      return "start";
                 }





            A few steps later (and even works when you jump out of conversation and come back into it through the conversation picker).


            <s:fragment rendered="#{risingstars.crudsController.getMode() == 'CREATE'}">
                 <a4j:commandButton styleClass="general_form_button" id="create" type="submit"
                      action="create" value="#{messages.button_register}"
                      onclick="this.disabled=true; document.body.style.cursor='wait'"
                      oncomplete="this.disabled=false; document.body.style.cursor='auto'" />
            </s:fragment>







            Seems totally overkill, but alas, it just works... so move on..


            Day End.

            • 3. Re: The real problems of using Seam...
              tony.herstell1

              Of course to get the last step working had to hit refresh 20 times till I was SURE the page had been updated (wheras in the good old days I could just refresh first time every time and know it worked).




              ;)

              • 4. Re: The real problems of using Seam...
                tony.herstell1

                This appears to be the main problem with jPDL acting odd:


                JPDLReinstallingItsFirstSeamObject


                Going to raise a critical.