1 Reply Latest reply on Jul 13, 2010 10:27 AM by luciano87

    Problens with @DataModel @DataModelSelection and @Factory cache.

    luciano87

      Helo guys,


      I'm having some problens usign @DataModel @DataModelSelection and @Factory together.


      Scenario:


      When the screen is displayed, a rich:dataTable is populated with an instance variable initialized by a @Factory anotated method.


      Then there is a filter method that is invoked by ajax and update that ArrayList according to the filters.


      The DataTable has options to View or Edit the itens using an entity anotated with DataModelSelection.


      Problem:


      The DataModelSelection is working fine with the initial ArrayList loaded by the @Factory method.


      When I  user the filter method, my DataTable is update correctly according to the filters.


      But when I try to use the View button of the datatable in the Filtered ArrayList, the seam populated the DataModelSelection with the object of the @Factory initialized ArrayList.


      Conclusion, the seam is caching the ArrayList with the datas of the @Factory Method. My Ajax method is not updating the seam cache.


      Code:



          @In(create=true)
          PeopleFacade peopleFacade

          @DataModel("peoples")
          private List<People> peoples

          @DataModelSelection("peoples")
          @Out(required = false)
          private People people;

          private PeopleVO filters = new PeopleVO();

          @Factory("peoples")
          public void loadPeoples(){
             this.peoples = peopleFacade.list();
          }
         
          /*
          *  Invoked via Ajax
          */
          public void filter(){
             this.peoples = peopleFacade.filter(filters)
          }


          ... gets and sets of peopleVO




      Anybody can help me?


      Thanks.

        • 1. Re: Problens with @DataModel @DataModelSelection and @Factory cache.
          luciano87
          Sorry about the code format.

          Fixed:

          @In(create=true)
          PeopleFacade peopleFacade

          @DataModel("peoples")
          private List<People> peoples

          @DataModelSelection("peoples")
          @Out(required = false)
          private People people;

          private PeopleVO filters = new PeopleVO();

          @Factory("peoples")
          public void loadPeoples(){
            this.peoples = peopleFacade.list();
          }

          /* * Invoked via Ajax */
          public void filter(){
            this.peoples = peopleFacade.filter(filters)
          }

          ...
          gets and sets of peopleVO