[jboss-user] [JBoss Seam] - Stateless Session Bean and @Out

jfrankman do-not-reply at jboss.com
Thu Nov 15 10:06:12 EST 2007


I am trying to understand when Stateless session beans should be used within the Seam framework. I orginally thought I could outject from a Stateless Session Bean to my JSF page as follows:


@Stateless
  | @Name("myBeanA")
  | public class MyBeanAImpl implements MyBeanA
  | {
  | 	@Out(required = true) 
  | 	List<Rptprdmgbinder> propertyBinders;
  | 
  | 	public String showPropertyDamageBinders()
  | 	{
  | 		Date filterDate;
  | 		Calendar cal=Calendar.getInstance();
  | 		cal.set(2007, 10,5);
  | 		filterDate=cal.getTime();
  | 		propertyBinders=countyOfficeDocService.getPropertyBinders(worker.getOffice().getId(), filterDate);
  | 		return "";
  | 	}

But this only works if I specify conversation scope on the outjected variable:

@Stateless
  | @Name("myBeanA")
  | public class MyBeanAImpl implements MyBeanA
  | {
  | 	@Out(required = true,scope=ScopeType.CONVERSATION) 
  | 	List<Rptprdmgbinder> propertyBinders;
  | 
  | 	public String showPropertyDamageBinders()
  | 	{
  | 		Date filterDate;
  | 		Calendar cal=Calendar.getInstance();
  | 		cal.set(2007, 10,5);
  | 		filterDate=cal.getTime();
  | 		propertyBinders=countyOfficeDocService.getPropertyBinders(worker.getOffice().getId(), filterDate);
  | 		return "";
  | 	}

I still need to study the inner workings of a Stateless Session bean, but can anyone explain cases or examples where using a stateless session bean within a Seam application would be advisable? Does it ever make sense to use a Stateless session bean for an Action Listener by outjecting a variable into a conversation scope (as shown above) or is it better to use a Stateful session bean?

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

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



More information about the jboss-user mailing list