[jboss-user] [JBoss Seam] - @Factory and @DataModel on the same method

fabricio.lemos do-not-reply at jboss.com
Thu Mar 15 19:54:37 EDT 2007


Is it possible to have @Factory and @DataModel on the same method?

At first I had this class:


  | @Stateful
  | @Name("displayUseCases")
  | @Scope(ScopeType.EVENT)
  | public class DisplayUseCasesAction implements DisplayUseCases {
  | 
  | 	@EJB
  | 	private UseCaseBsn useCaseBsn;
  | 
  | 	@DataModel (scope = ScopeType.PAGE)
  | 	private List<UseCase> useCaseList;
  | 
  | 	@Factory("useCaseList")
  | 	public void initUseCaseList() {
  | 		useCaseList = useCaseBsn.getAll();
  | 	}
  | 	
  | 	@Destroy @Remove
  | 	public void destroy() {	}
  | 

But, to avoid declaring a variable that was not used, I changed it to:


  | @Stateful
  | @Name("displayUseCases")
  | @Scope(ScopeType.EVENT)
  | public class DisplayUseCasesAction implements DisplayUseCases {
  | 
  | 	@EJB
  | 	private UseCaseBsn useCaseBsn;
  | 
  | 	@DataModel (scope = ScopeType.PAGE)
  | 	@Factory("useCaseList")
  | 	public List<UseCase> getUseCaseList() {
  | 		return useCaseBsn.getAll();
  | 	}
  | 	
  | 	@Destroy
  | 	@Remove
  | 	public void destroy() {	}
  | }
  | 

After changing it, the application runs ok but I get the exception:
20:44:31,894 WARN  [Contexts] Could not destroy component: displayUseCases
javax.ejb.EJBNoSuchObjectException: Could not find Stateful bean: a5k2v46-y6may6-ezbt3tyr-1-ezbun2fe-10

even doing the things stated at:
http://wiki.jboss.org/wiki/Wiki.jsp?page=JbossTimeoutSettingForSeam

thanks in advance,
Fabrício Lemos

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

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




More information about the jboss-user mailing list