[jboss-user] [JBoss Seam] - Can't inject entityManager into application component?
RobJellinghaus
do-not-reply at jboss.com
Fri Aug 25 03:22:55 EDT 2006
Why doesn't this work?
@Startup
| @Scope(APPLICATION)
| @Name("replogApplication")
| public class ReplogApplication {
| ...
| @In(create=true)
| private transient EntityManager entityManager;
|
| @Create
| public void init ()
| {
| log.debug("Creating replogApplication");
|
| // for now, create one SiteSynchronizer per defined Site
| List<Site> sites = entityManager.createQuery("from Site").getResultList(); // line 37
| ...
| }
|
I get this at startup time:
[testng] java.lang.NullPointerException
| [testng] at com.robjsoftware.replog.ReplogApplication.init(ReplogApplication.java:37)
| [testng] at com.robjsoftware.replog.ReplogApplication$$EnhancerByCGLIB$$dfe7020b.CGLIB$init$0(<generated>)
| [testng] at com.robjsoftware.replog.ReplogApplication$$EnhancerByCGLIB$$dfe7020b$$FastClassByCGLIB$$52404ff7.invoke(<generated>)
| [testng] at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:167)
| [testng] at org.jboss.seam.interceptors.JavaBeanInterceptor$1.proceed(JavaBeanInterceptor.java:80)
Why isn't an entityManager being injected? Is it against the rules for an application-scoped component to have an injected EntityManager? Couldn't find that documented anywhere. If I missed it, where was it documented?
Thanks for any clues,
Rob
(P.S. Hope you had a great vacation Gavin! ... if you're back yet! :-)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3967413#3967413
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3967413
More information about the jboss-user
mailing list