4 Replies Latest reply on May 10, 2007 9:37 PM by tonylmai

    @Factory usage

      Hello,

      Borrowed the concept from example "message", I implemented the following Seam component:

      @Stateful
      @Scope(ScopeType.SESSION)
      @Name("orderMgr")
      public class PendingOrdersManagerBean implements PendingOrdersManager, Serializable {
       private static final long serialVersionUID = 1L;
      
       @DataModel
       private List<TdOrderInfo> workingOrders;
      
       @DataModelSelection
       @Out(required=false)
       private TdOrderInfo orderInfo;
      
       @Factory("workingOrders")
       @Observer("newOrder")
       public void getPendingOrders() {
      ...
      }


      And

      @Name("orderInfo")
      @Scope(ScopeType.EVENT)
      public class TdOrderInfo implements Serializable {
       private static final long serialVersionUID = 1L;
       private OrderInfo orderInfo = null;
       private String lockOwner = null;
      
       public TdOrderInfo() {}
      ...
      }


      However, the method that is marked with @Factory was never called.

      What am I missing here?

      Thanks

        • 1. Re: @Factory usage

          I forgot to mention that the client accesses this component as followed:

          <h:dataTable value="#{orderMgr.workingOrders}" var="ord" rendered="#{orderMgr.workingOrders != null and orderMgr.workingOrders.rowCount>0}" >
          


          This table was not rendered as you could imagine if the '@Factory" method was not invoked.

          Thanks

          • 2. Re: @Factory usage
            jazir1979

            Hi Tony,

            The @Factory annotation creates a Seam component in its own right, it's not a property of the "orderMgr" bean.

            So I think you should use value="#{workingOrders}" in your data table.

            Hope it helps,
            Daniel.

            • 3. Re: @Factory usage
              jazir1979

              Context variable, not component. But y'know what I mean ;)

              • 4. Re: @Factory usage

                Got it to work. Thanks Daniel.