4 Replies Latest reply on May 18, 2009 3:45 PM by Israel Fonseca

    Seam Transaction vs Container Transaction

    Israel Fonseca Apprentice

      After reading the:
      http://seamframework.org/Documentation/WhenDoIUseInVsPersistenceContextToInjectAnEntityManager


      I think that the Seam Managed Transaction is always better than the container managed transaction. So.. in terms of transaction using Seam with Tomcat that do not have container managed transactions and JBoss-AS that do have, and using Seam Managed Transactions you dont have a big difference of perfomance (about transaction handling). Is that right? Because Seam, not the container, that will handle it anyway...


      I ask that because we want a lightweight container, and assuming that we dont need EJB services, and the transaction would be handled with Seam even in JBoss AS (no container managed transactions), using Seam with Tomcat seems to me that it would be a better idea.


      Is that right? Any opinions?

        • 1. Re: Seam Transaction vs Container Transaction
          Arbi Sookazian Master

          There is no right or wrong here (IMO).


          You have the advantage of true hot incremental deployment with JavaBeans that you don't have with EJB components.


          You are losing EJB timer, EJB interceptor for business methods (e.g. profiling method exec times), EJB transactions (you lose REQUIRES_NEW with Seam @Transactional), JTA distributed transactions (if you need it it's available with EJB), JMS/MDB, method-level security.


          I'm a fan of EJB3 but there are advantages and disadvantages either way.


          But if you really want to avoid EJB, then you could use Spring/Hibernate as well...


          • 2. Re: Seam Transaction vs Container Transaction
            Arbi Sookazian Master

            Also with SLSB, the ejb container maintains and manages a SLSB pool for you.  Not sure if/how Seam does this with JavaBean components.


            And with SFSB, the ejb container uses algorithms to passivate your SFSB to disk, etc and activate back into memory as required.


            How does Seam handle this for session-scoped JavaBean components, if at all?

            • 3. Re: Seam Transaction vs Container Transaction
              Riccardo Serafin Newbie

              Arbi Sookazian wrote on May 16, 2009 00:11:


              You are losing [...] method-level security.



              Isn't Seam @Restrict covering that?


              Riccardo.

              • 4. Re: Seam Transaction vs Container Transaction
                Israel Fonseca Apprentice

                Hmm, in fact Seam doesn't have anything like the pooling or the passivate of SLSB/SFSB, I think. Anyway, from my studies pooling is not a miraculous thing for performance(maybe it was some time ago), and about the passivate thing, well i don't know, but it propabbly help to save memory or keep an application running even without enough RAM on the server. What can you say about, in numbers? Simply being a EJB increasse how much performance?


                About Spring/Hibernate for transactions, again, is a bad thing to use plain Seam/JPA(Hibernate)?


                And i think that Riccardo is right.


                Thks for the answers.


                Israel