3 Replies Latest reply on Mar 29, 2008 7:32 PM by Pete Muir

    Problem with startup data

    Stijn Cremers Novice

      I have an method that is called after the initialization of seam:



      @Observer("org.jboss.seam.postInitialization")
      public void loadBasicData(){
           dropdowntypesService.retrieveDropdowntypes();
           fieldhelptextService.retrieveFie
      }



      These methods loads some data in Map that are stored in on the Application Context in the following way:



      @Name("fieldhelptextService")
      @Stateless
      public class FieldhelptextService implements IFieldhelptextService{
      
           @In
           private EntityManager entityManager;
           
           @Out(scope=ScopeType.APPLICATION)
           private Map<String, String> fieldhelptextMap = new HashMap<String, String>();
           
           public String getEjbql() {
                return "select fieldhelptexts from Fieldhelptexts fieldhelptexts";
           }
           
           
           @SuppressWarnings("unchecked")
           public void  retrieveFieldhelptext(){
                fieldhelptextMap.clear();
                Collection<Fieldhelptexts> result = entityManager.createQuery(getEjbql()).getResultList();
                for( Fieldhelptexts i : result){
                     fieldhelptextMap.put(i.getFieldname(), i.getHelptext()); 
                }
      
           }
           
      }
      



      But after accessing these methods the first time, all these Maps are empty.