0 Replies Latest reply on Dec 11, 2009 11:46 AM by Arnaud Morel

    Destroying a context variable

    Arnaud Morel Newbie
      Hi,

      I have a seam component:
      @Name("lotSaisieAction")
      @Scope(ScopeType.CONVERSATION)
      public class LotSaisieAction implements java.io.Serializable {
           @In(create = true) @Out
           protected LotBO lot;

      When a page access this component, it might provide an existing lot. If not, it is created in this component with:
      lot = new LotBO();

      It works, but I have an issue.
      Sometimes I have an existing lot, but I want to create a new one.
      I do: lot = new LotBO();
      Which works inside the page.

      But... as soon as I get into another page (which access the same seam component lotSaisieAction, I get my old lot!
      Which means that seam didnt store the lot instance in context.

      Here what I have in debug:
      lot (id=4559) : existing lot in context
      lot = new LotBO();
      lot (id=4569) : new lot, id is correctly change
      validate current page, next page will access the same component. I should get my new lot because I have @In @Out
      lot (id=4559) : it fails, I get the fitst one that was put in context with @Out

      I can't destroy my session because I have many others variables in context.
      I don't see what I can do except manually setting everything in my current lot to make it new (which is not a fast solution!)