[jboss-user] [JBoss Seam] - The method destroy is called twice

deved do-not-reply at jboss.com
Mon Aug 13 17:33:24 EDT 2007


Hi all. I have this:
TableModel.java

  | @Name("tableModel")
  | @Conversational
  | @Scope(ScopeType.CONVERSATION)
  | public class TableModel {
  |     
  |   @In
  |   private EntityManager em;
  |   
  |   private List data;
  | 
  |   @Begin
  |   public void begin(Class entityClass) {
  |     data = query(entityClass);
  |   }  
  | 
  |   @Destroy
  |   public void clean() {
  |     data.clear();
  |     data = null;
  |   }
  | 
  |   public List getData() {
  |     return data;
  |   }
  | 
  |   private List query(Class entityClass) {
  |     ....
  |   }
  | }
  | 
MenuManager.java

  | @Name("menuManager")
  | @Scope(ScopeType.SESSION)
  | public class MenuManager{
  |   
  |   private TableModel tableModel;
  | 
  |   public String redirect() {
  |      if(tableModel != null) {
  |         tableModel.clean();
  |      }
  |      tableModel = (TableModel) Component.getInstance("tableModel", ScopeType.CONVERSATION);
  |      tabelModel.begin(SomeEntity.class);   
  |   }
  | }
  | 
When I call "tableModel.clean()" the field "data" on TableModel is null.
Then when the session is ended or the conversation timeout expire the method is called again, this is right?
Any help, thanks.

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

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



More information about the jboss-user mailing list