3 Replies Latest reply on Jun 19, 2007 12:30 PM by Markus Wolf

    Extending ThemeSelector

    Markus Wolf Newbie

      I've extended the theme selector based on this description: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=103571

      I need an entity manager inside it and therefore added an @In annotation to my manager property, but when the (overriden) select method is called the entity manager is null.
      Anyone has an idea why this is the case? All my other beans and enterprise beans do work as expected and get the entity manager injected.

      Below is the relevant part of my code:

      @Name("org.jboss.seam.theme.themeSelector")
      @Scope(ScopeType.SESSION)
      @Intercept(InterceptionType.NEVER)
      @Install(precedence = Install.APPLICATION)
      public class CampaignTheme extends ThemeSelector {
      
       @In
       private EntityManager em;
      
       /**
       * @see org.jboss.seam.theme.ThemeSelector#select()
       */
       @Override
       public void select() {
       String theme;
       try {
       theme = (String) this.em.createQuery("...")
       .getSingleResult();
       } catch (NoResultException e) {
       theme = DEFAULT_THEME;
       }
       setTheme(theme);
       }
      ...