1 Reply Latest reply on Dec 12, 2010 2:29 PM by Andrzej Legucki

    Saving data from @DataModel

    Andrzej Legucki Newbie

      Hi,
      In method updateStage I'm trying to save only one object from list created using @Factory method, but it always saves all elements from list. How can I make it work?



      @Stateless
      @Name("stageBean")
      public class StagesBean implements Stages
      {
           @In(create=true)
           @Out(required=false)
           StagesSchedule stage;
          
           @DataModel
           private List<StagesSchedule> stages;
      
           @DataModelSelection
           private StagesSchedule selectedStage;
          
      
           @PersistenceContext
           EntityManager em;
      
           public void updateStage()
           {
                StagesSchedule s = stages.get(0);
                em.merge(s);
           }
      
           @Factory("stages") 
           public void findStages(){
                stages = em.createQuery("select s from StagesSchedule s order by s.name").getResultList();
           }
      
           @Remove
           public void destroy() {}
      }