3 Replies Latest reply on Oct 23, 2008 3:34 AM by Francisco Jose Peredo Noguez

    What is the benefit of EJB?

    Stephan B Newbie

      Hi everybody,


      as you can guess from the subject my question is in regard to the benefit of using EJB3 in Seam (compared to POJOs).


      I looked up this question quite some time and I mostly found the answers:
      - it scales better (replication)
      - it's more secure
      - it has transactions
      - asynchron messages can be used


      Well all of these points are important to me; however, as far as my understanding about Seam goes, it can handle the above issues very good without EJB (using JBoss Cache, Drools, JPA, Quartz etc.). Right?


      I also found the assumption that using EJB would cost about 10% performance compared to POJOs and that startup time as well as footprint is much smaller (e.g. using Tomcat over JBoss).


      I'm confused. Can anybody make things clearer?


      Thanks!

        • 1. Re: What is the benefit of EJB?
          Ronald van Kuijk Apprentice

          async messaging cannot be done without jms, jboss cache, albeit good, is 'proprietary', the performance is not because of ejb (not anymore, used to be years ago) but about the clustering etc...


          The memory footprint is (to me) a none-issue. Compared to all the other libs loaded, the extra amount is small.


          just my €0.01

          • 2. Re: What is the benefit of EJB?
            Riccardo Serafin Newbie

            Hello,


            I'm also super interested in this topic, as I share the same doubts of Stephan.


            Is there any one who could provide guidelines and experiences about when to use EJB and exactly for which features, explaining why what is already offered by the framework is not enough?


            Thanks to everyone,
            R.

            • 3. Re: What is the benefit of EJB?
              Francisco Jose Peredo Noguez Master

              Stephan B wrote on May 11, 2008 21:24:


              Hi everybody,

              as you can guess from the subject my question is in regard to the benefit of using EJB3 in Seam (compared to POJOs).

              I looked up this question quite some time and I mostly found the answers:

              - it scales better (replication)

              - it's more secure


              Yes? Why? I can not think of a reason.

              - it has transactions

              with POJOs you also have transactions. Maybe you mean distributed transactions? (An those you only need for very specially an rare cases where for example half of you tables are in Oracle, and half are in SqlServer)

              - asynchron messages can be used

              Well all of these points are important to me; however, as far as my understanding about Seam goes, it can handle the above issues very good without EJB (using JBoss Cache, Drools, JPA, Quartz etc.). Right?

              AFAIK you are right, but I also would like to get a more detailed explanation.

              I also found the assumption that using EJB would cost about 10% performance compared to POJOs and that startup time as well as footprint is much smaller (e.g. using Tomcat over JBoss).

              In my experience, if you compare JBoss and Tomcat, everything runs a lot faster in Tomcat (I am not talking about production time, I am talking about development time: it takes around 30 secs for me to cold start my app in JBoss vs 7 secs to cold start in Tomcat, and since I do a lot of restarts in single day...). I wonder when will we finally get MVM support for Java!



              I also prefer Tomcat because JBoss easily contaminates with each project (again during development) See JBIDE-2627

              And finally because I can choose the version of Hibernate, JSF, and CeltiXFire to use in my project without risking any conflict (or messing with) those included in JBoss. Another thing I really miss in JBoss is an Web UI to manage the appserver. I do not want anything fancy, but the current one that exposes me the raw JMX stuff is just not comfortable (I hope that changes with JBoss AS 5).


              I'm confused. Can anybody make things clearer?

              Thanks!


              In summary, if you are not sure, I recommend you to go with POJOs. They are still simpler than EJB3.