1 2 3 4 Previous Next 45 Replies Latest reply on May 12, 2009 5:42 AM by swd847

    Seam EJB3 vs. Seam POJO

      What are their advantages and disadvantages? (from http://seamframework.org/Community/JBossVsTomcatReviewForOthersToRead)

        • 1. Re: Seam EJB3 vs. Seam POJO
          geofrank

          Here is some of the advantages by using Seam-managed JavaBeans. I suppose someone out there is better suited than me to explain the advantages of EJB.




          • You are not forced to write interfaces for every class.

          • You can work outside an EJB-container, making it much more convenient when using servlet containers like Jetty.

          • There is less boilerplate configuration.

          • Hot-deployment of components by the special Seam Classloader is possible.

          • For regular non-clustered use, it's a bit faster.


          • 2. Re: Seam EJB3 vs. Seam POJO
            chawax

            Using Seam EJB3 components you benefit very useful features of EJB3.



            In the reference manual (§4.2.4) you can read this :



            Javabeans may be used just like a stateless or stateful session bean. However, they do not provide the functionality of a session bean (declarative transaction demarcation, declarative security, efficient clustered state replication, EJB 3.0 persistence, timeout methods, etc).
            • 3. Re: Seam EJB3 vs. Seam POJO

              Olivier Thierry wrote on Jan 20, 2009 15:16:


              Using Seam EJB3 components you benefit very useful features of EJB3.


              In the reference manual (§4.2.4) you can read this :

              Javabeans may be used just like a stateless or stateful session bean. However, they do not provide the functionality of a session bean (declarative transaction demarcation, declarative security, efficient clustered state replication, EJB 3.0 persistence, timeout methods, etc).



              This is AFAIK true:


              1. efficient clustered state replication: Of course the question here could be: How much efficiency do you really need? is plan Tomcat clustering good enough for you? if it is, the you do not need EJBs.



              This are, AFAIK false:


              1. declarative transaction demarcation: AFAIK  the annotation org.jboss.seam.annotations.Transactional works for POJOs

              2. declarative security: Mmmm, I believe that org.jboss.seam.annotations.security.Restrict works for POJOs... Am I wrong?

              3. EJB 3.0 persistence: This is also available if you use POJOs, it is called JPA ;-)



              And this, I just do not know:


              1. timeout methods: Timeouts... for what exactly?







              Click HELP for text formatting instructions. Then edit this text and check the preview.

              • 4. Re: Seam EJB3 vs. Seam POJO
                www.supernovasoftware.com

                I use almost exclusively EJB3 SLSB and SFSB.  It works quite well.


                However, the only real complaint I have is not being able to hot deploy components.


                Vote for EJBTHREE-1096


                It has a very large number of votes, but is consistently ignored and has no comments on how, if, or when this might be a reality.


                Redeployment of my ear, which is getting larger and larger, is sucking up ridiculous amounts of time.


                And, I do not want to switch to POJOs because I am unsure of the subtle differences that might break my application.


                That is the only reason I can see not to use EJB3, but it is a big one.


                Any suggestions on how to improve the development process with Seam and EJB3 would be most welcome.


                • 5. Re: Seam EJB3 vs. Seam POJO

                  Well, based on you post, I see an implicit reason not to use EJBs: You couldn't name a single good reason to use them.


                  And you did provide me with a really good reason not to use EJBs (EJBTHREE-1096).


                  Long life to POJOs! Death to EJBs! ;-)

                  • 6. Re: Seam EJB3 vs. Seam POJO
                    www.supernovasoftware.com

                    Well I adopted this child when Seam first came out and it was plugged as the magic glue to make JSF and EJB3 a dream come true.


                    For my case I probably do not need them.  I do not use clustering, but I do plan on using MDB soon.


                    I have been raising this child for a long time and I have a few hundred SLSB nd SFSB beans.


                    I don't feel like it would be trivial to switch.


                    Has anyone made a large scale switch from EJB3 to Seam POJOs in a production application?

                    • 7. Re: Seam EJB3 vs. Seam POJO
                      cpopetz

                      Has anyone made a large scale switch from EJB3 to Seam POJOs in a production application?


                      We did, and it was very easy, and eliminated a number of problems we were having, particularly with respect to clustering/passivation/threading/classloading  It also sped up startup of jboss in development and of embeddedJboss in testing quite a bit.  And we're just getting ready to eliminate our dependency on embeddedJboss at test time altogether, by moving away from a JNDI-based entityManagerFactory and JTA during testing, which were the last EE dependencies of ours.


                      We had a hundred or so SLSBs, and a dozen or so SFSBs. 


                      It was probably easier for us because we adopted EJB when we adopted seam, and so we did all our injections with seam annotations, not EJB3 annotations.  It was therefore simply a matter of exchanging @Stateful and @Stateless in favor of @Scope annotations, adding @Transactional annotations, and getting rid of a zillion interfaces (something I dearly hate about EJBs.)  I did it with a perl script :)


                      JPA is great, as is JTA.  But the rest of EJB3 is problematic, IMHO, and should only be leveraged if you really need it.

                      • 8. Re: Seam EJB3 vs. Seam POJO
                        www.supernovasoftware.com

                        I have been attempting to switch from EJB3 to POJO because it is totally killing my productivity as my project grows.


                        Also EJBTHREE-1096 seems totally dead even though it has a very large number of votes and interest.


                        I removed the @Stateless and added @Scope annotations, adding @Transactional, but my problem is that all my SLSB DAOs(over 100) use



                            @PersistenceContext 
                            public EntityManager entityManager;




                        This behaves differently due to the fact that it propagated across the transaction rather than the conversation if I switch to


                            @In 
                            public EntityManager entityManager;



                        I get an error when trying to use @PersistenceContext without @Stateless or @Stateful and my application behaves differently using the SMPC.



                        How can I get the EntityManager to behave like using @PersistenceContext in a Seam component that is not a SLSB or SFSB?



                         

                        • 9. Re: Seam EJB3 vs. Seam POJO
                          swd847

                          Using an event scoped entity manager would stop the entityManager being propagated with the conversation. The behavior is not exactly the same, but it is close. Notable differences are that the entityManager would span 2 transactions (as seam creates 2 transactions for each page view) and you no longer have access to the REQUIRES_NEW transaction attribute. There are probably other differences as well, but I can't think what they are off the top of my head.

                          • 10. Re: Seam EJB3 vs. Seam POJO
                            www.supernovasoftware.com
                            Thanks for the advice, but I need it to behave exactly the same.
                            I do not make use of REQUIRES_NEW.

                            I have a relatively large production app (100 SFSB and 100 SLSB) with very little tests written.

                            I cannot afford to be chasing bugs around due to this switch and I also cannot continue to redeploy the ear for every change.

                            I feel like I am stuck between a rock and a hard place and wish I had never used EJB3, but I started this app when Seam was still Beta and EJB3 with JSF was supposed to be a fantastic combination.

                            Should I hold out for the Hot Deploy of EJB3s or turn this app inside out?
                            • 11. Re: Seam EJB3 vs. Seam POJO

                              Jason, have you looked at JavaRebel? we have an ejb3 seam app and find JavaRebel helps a lot.  It doesn't pick up new functions or variables in a class, but often with debugging etc the changes are going on inside a function and JavaRebel gives us instant hot deployment of entity and session beans for this scenario.

                              • 12. Re: Seam EJB3 vs. Seam POJO
                                www.supernovasoftware.com

                                Really.


                                How is this different from JVM HotSwap?

                                • 13. Re: Seam EJB3 vs. Seam POJO

                                  I think this is a very wild guess, but... have you tried EasyBeans and Tomcat? it seems that EasyBeans comes as an OSGi bundle, and (maybe, and this is a really big maybe) it could natively support hot deployment (I know for sure that OSGi can do it, the question here is... EasyBeans makes it possible to do it with EBJs? )

                                  • 14. Re: Seam EJB3 vs. Seam POJO

                                    At least the seem to be trying to do it. Of course, it could be ready when it is too late for your project

                                    1 2 3 4 Previous Next