0 Replies Latest reply on Jun 9, 2006 7:21 PM by kristof d

    Pojo or stateful EJB destroyed immediatly if using conversat

    kristof d Newbie

      I can travel sucessfully through a tree, by using a stateless EJB(BrowseAction) action that updates a named Pojo(State). keeping the state. Everything session scope (!).

      In order to allow multiple windows browsing at the same time, I am trying to use conversations(!). A quick solution without changing much code: action starts up a conversation in the state object.

      @Stateful //tried stateful too
      public class BrowseAction implements Browse{
       @In(scope=ScopeType.CONVERSATION, value="#{state}") @Out(scope=ScopeType.CONVERSATION)
       private State state;
       public String changeTree() {
       return nextPage();


      ***State: ***
      public class StateSB implements Serializable, State{
       public void startConversation() {
       public void endConversation() {
       public StateSB() {
       System.out.println("....Creating State:"+this);
      @Remove @Destroy
      public void destroy() {System.out.println("+++++++++ destroying state" );}

      With this code or all small alternatives (See @In attribs) I tried, I notice that when I use "Scope.conversational", my state object is being destroyed after my changeTree is being called & executed correctly. I.e. the state seems to be never really saved back into the context (so, I got fresh page each time). I thought the destroy is maybe inited from the BrowseAction, which is why I tried that one to be stateful... If I change state to SESSION again, everything works fine, no destructions (but then 2 windows are not browsing independent)

      Same thing did not work leaving the State object as a POJO (cfr. 'numberguess'example Seam doc, but then without using pageflow attrib. (is this required?) )

      By the way, is it correct to use stateful EJB versus named POJOs when there is more functionality than getters&setters?

      This was intended to be a quick enhancement.. but I can't get it working :(