3 Replies Latest reply on Mar 24, 2009 9:27 AM by Mark S

    Correct way of creating Seam Non-EJB pojo

    Mark S Newbie

      I intend to create Seam pojo only so i can deploy it on tomcat. What are the proper ways of making sure its pojo only and not EJB? So far, all that i read about is that:


      1) Don't use @Stateless or @Stateful annotations
      2) Don't use Message Driven Bean
      3) Don't inject using @EJB


      What other properties for making Seam pojo i should be aware of?

        • 1. Re: Correct way of creating Seam Non-EJB pojo
          Arbi Sookazian Master

          Seam Pojo is simply a JavaBean with @Name annotation applied at the class level. 


          Default scope is EVENT (think HttpServletRequest scope in the Servlet API) so if you need to use it as a backing bean for xhtml actions in a multi-request/response use case, for example, then you will need to annotate as such:


          @Scope(ScopeType.CONVERSATION)



          then you should

          implement java.io.Serializable

          as well b/c the conversation context is a Seam-managed area in the HttpSession object.


          You obviously don't need to implement a local/remote interface as you do with EJB3 SFSB/SLSB.


          getters, setters, and properties in a class with @Name, that's about it.


          read Seam in Action or the new Yuan book, they will answer most of your questions there...


          • 2. Re: Correct way of creating Seam Non-EJB pojo
            Arbi Sookazian Master

            btw, check out the @AutoCreate Seam annotation, in case you will be injecting your JavaBean into other Seam components (so you use @In instead of @In(create=true)).  less code.

            • 3. Re: Correct way of creating Seam Non-EJB pojo
              Mark S Newbie

              Finally Seam in Action book arrived ....and yea it did answered most of my questions. Thanks for the help Ron.