[jboss-user] [JBoss Seam] - Problem stateful beans sharing properties

markauro do-not-reply at jboss.com
Thu Feb 7 11:06:49 EST 2008


Hello,

I'm using JBoss 4.2.2GA with Seam 2.0.1.CR1, i've started my seam application using Booking example as a template, so i have a stateful bean that make a search into de DB (using the EntityManager) and get a list of Entities like the HotelSearchingAction. 

This is my stateful bean:


  | @Stateful
  | @Name("operationList")
  | @Scope(ScopeType.SESSION)
  | public class OperationListAction implements IOperationList {
  | 
  | 	@Logger
  | 	private Log log;
  | 	
  | 	@PersistenceContext(type=PersistenceContextType.EXTENDED)
  | 	private EntityManager em;
  | 	
  | 	private Operation operacionForm;
  | 	
  | 	@DataModel
  | 	private List<Object> resultList;
  | 	
  | 	@DataModelSelection
  | 	private Operation operacion;
  | 	
  | 
  | 	private int pageSize = 10;			
  | 	private int page = 0;		
  | 	private int numPages = 0;	
  | 	private String order = "";
  | 
  |         ......
  | }
  | 

It was running well, but i made another stateful bean that make a different search with different name, same scope, and the same properties (page, pageSize, etc..).
For my surprise, it seems to be sharing te properties that has identical names and types between the beans, so if i make a search and go to de 2nd page, changing the page number in one of the stateful bean, then making a search using the other bean initially displays the 2nd page as well.

The other stateful bean:


  | @Stateful
  | @Name("companyList")
  | @Scope(ScopeType.SESSION)
  | public class CompanyListAction implements ICompanyList {
  | 	
  | 	@Logger
  | 	private Log log;
  | 	
  | 	@PersistenceContext(type=PersistenceContextType.EXTENDED)
  | 	private EntityManager em;
  | 
  | 	private Company companyForm;
  | 	
  | 	@DataModel
  | 	private List<Object> resultList;
  | 	
  | 	@DataModelSelection
  | 	private Company company;
  | 	
  | 
  | 	public int pageSize = 10;			
  | 	public int page = 0;	
  | 	public int numPages = 0;
  | 	public String order = "";
  | 
  |         ......
  | }
  | 

Is this the default behavior? or i am doing somethig wrong, perhaps the configuration is not the best for this porpouse...

I am a rookie whith seam, so any suggestion is welcome.


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

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



More information about the jboss-user mailing list