8 Replies Latest reply on Apr 14, 2007 8:06 PM by Andy Gibson

    DataModelSelection not updated

    Andreas Franke Apprentice

      Hi,

      have a table and use row selection with DataModelSelection. If the whole table is loaded all is perfect. But when I use searchpattern like in booking example(ajax) to reduce tablesize DataModelSelection not updated. For example all times the first row from whole table is selected while this row no longer exist in reduced table.

      public abstract class AbstractListBean<T extends BaseEntity>implements Serializable {
      
       protected String searchString;
      
       @PersistenceContext
       protected EntityManager em;
      
      
       @DataModelSelection
       private T selectedEntity;
      }
      


      @Stateful
      @Scope(ScopeType.CONVERSATION)
      @Name("specialreleaselist")
      @SuppressWarnings("unchecked")
      public class SpecialreleaseListBean extends AbstractListBean<SpecialRelease> implements
       SpecialreleaseList {
      
       /**
       *
       */
       private static final long serialVersionUID = 1L;
      
      
       @In
       FacesMessages facesMessages;
      
       @DataModel
       protected List<SpecialRelease> sprTablelist;
      
      
       @Factory("sprTablelist")
       public void find(){
       sprTablelist = loadList();
       }
      @Factory(value="specialreleasepattern", scope=ScopeType.EVENT)
       public String getSearchPattern(){
       return searchString==null ?
       "%" : '%' + searchString.toLowerCase().replace('*', '%') + '%';
       }
      
      
       protected List<SpecialRelease> loadList() {
       List readFromDB = null;
       readFromDB = readFromDB("select s from SpecialRelease s where lower(s.description) like #{specialreleasepattern}");
      
       return readFromDB;
       }
      }


      What is the right way updating DataModelSelection?


      Thanks
      Andi