[jboss-user] [JBoss Seam] - Extending ThemeSelector

KnisterPeter do-not-reply at jboss.com
Tue Jun 19 10:47:42 EDT 2007


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);
  | 	}
  | ...
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4055664#4055664

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4055664



More information about the jboss-user mailing list