1 Reply Latest reply on Mar 25, 2008 8:00 PM by William Woodman

    seam framework events observer not working 

    William Woodman Master

      just copied this against mike kabirs query

      I cant get the auto refresh of a an EntityQuery child to work when i persist the related entity class.

      heres what i have in code

      i have an entity class Node , a NodeHome, and NodeList.  The last two are seam conversational named classes.

      in my UI i have pageList.xhtml that displays the results from the NodeList framework backing bean.  in the UI if you want to add a new node theres a link to do this, and i start the node.xhtml as part of a nested conversation. 

      however when you persist the new node my NodeHome @Observer method is never called - so i get no auto refresh.

      here is part of the nodeList defn

      @Scope (ScopeType.CONVERSATION)
      public class NodeList extends PagedEntityQuery<Node>
           private static final long serialVersionUID = 1;
           private String searchString;
           /*declare the selected result to be injected on selection 
           Node node; */
           //Node QBENode;
           private Log log;
          @In FacesMessages facesMessages;
          @Observer ("org.jboss.seam.afterTransactionSuccess.Node")
          public void afterTransactionSuccess ()
               facesMessages.add("node list: refreshing list after successful transaction on nodeHome");

      equally in the NodeHome i ovverode the raise after transaction success method to check it was getting raised

      public class NodeHome extends EntityHome<Node>
           Long nodeId;
           private Log log;
          @In FacesMessages facesMessages;
          // TODO debug event handling then get rid of 
          protected String getEntityName()
               String en = super.getEntityName();
               facesMessages.add ("got simple entity name of #0", (en != null) ? en : "<null>");
               return en;
           * Raise events when a CRUD operation succeeds.
           * <br />
           * Utility method to raise two events: an event of type 
           * <code>org.jboss.seam.afterTransactionSuccess</code> is raised, along with 
           * an event of type 
           * <code>org.jboss.seam.afterTransactionSuccess.&lt;entityName&gt;</code>.
          protected void raiseAfterTransactionSuccessEvent()
               facesMessages.add("raising base trans success ");
             String simpleEntityName = getSimpleEntityName();
             if (simpleEntityName != null)
                  facesMessages.add("raising additional entity trans success #0", "org.jboss.seam.afterTransactionSuccess." + simpleEntityName);
                       raiseTransactionSuccessEvent("org.jboss.seam.afterTransactionSuccess." + simpleEntityName);

      When i run the forms i can see the event being raised as shown here in the facesMessages log.

      created new NodeHome, start nested conversation
      nodeHome factory initialsed new node
      Successfully created
      raising base trans success
      got simple entity name of org.domain.ForstersList.entity.node.Node
      raising additional entity trans success org.jboss.seam.afterTransactionSuccess.Node

      however i get to see no refresh fired on the NodeList observer.

      my UI does not automatically refresh to show me the node just persisted.  I have to manually trigger a refresh action from the nodeList.xhtml form.

      Dear seam team any ideas whats not happening - is it a bug?