4 Replies Latest reply on Sep 28, 2007 6:24 AM by Pete Muir

    Question of the day: Stateless Session Beans

    Thomas Gerhards Newbie


      Certainly Stateless Session Beans are usually used to call its methods from clients like Stateful Session Beans. The method returns and that's it, the Stateless SB will not remember anything. In Seam you would normally not use a Stateless SB with bijection. However the following simplified Stateless SB that outjects a book works well for me. All instance variables are overwritten with each call of its only method. As Stateless SBs are 1) cached and pooled and 2) synchronized I believe this is 1) faster than a Stateful SB and 2) does not mix up data for concurrent users.

      Could you please correct me if I'm wrong?

      public class BookDetailsAction implements BookDetails {
       String bookid;
       private Book book;
       private EntityManager em;
       public void findBook() {
       book = em.find(Book.class, id);