2 Replies Latest reply on Jun 3, 2006 10:39 AM by Lauri

    SessionBean vs. Static Method

    Oliver Hummel Newbie

      Maybe a stupid question, but I could not find any hints for this anywhere and I still wonder what is better: Implementing stateless helper methods (like save/load file etc.) in a steless session bean or as a static method in some helper class.

      Any help appreciated...

        • 1. Re: SessionBean vs. Static Method
          Lauri Newbie

          Static methods live inside one virtual machine and it is you who must take resposibility to "scale" solution and take other decisions on mny other issues.

          On other hand, J2EE containers does much the dirty work for you. You just need to give some details in deplayment descriptors.
          Container will decide how many instances of the loader/saved it needs to serve all incoming requests with optimal latency. Also J2EE edition of the loader/saver might be scaleable between many machines if J2ee container supports scaling.

          • 2. Re: SessionBean vs. Static Method
            Lauri Newbie

            I'd prefer staless bean which operates with local enity beans. It should be slower than usual static method but it will bring all the advances from message above.