[jboss-user] [JBoss Seam] - Question of the day: Stateless Session Beans

JUnkie do-not-reply at jboss.com
Thu Sep 27 05:08:51 EDT 2007


Hi,

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?

@Stateless
  | @Name("bookDetails")
  | public class BookDetailsAction implements BookDetails {
  |   
  |   @RequestParameter
  |   String bookid;
  |   
  |   @Out(required=false)
  |   private Book book;
  |     
  |   @PersistenceContext
  |   private EntityManager em;
  |     
  |   @Factory("book")
  |   public void findBook() {    
  |     book = em.find(Book.class, id);
  |   }
  |   
  | }

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4089208#4089208

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4089208



More information about the jboss-user mailing list