[jboss-user] [JBoss Seam] - Re: Can't inject entityManager into application component?

raja05 do-not-reply at jboss.com
Fri Aug 25 04:32:06 EDT 2006


"RobJellinghaus" wrote : 
  | Why does @PersistenceContext work here but @In doesn't?  I think I'm good to go now (modulo the possibility that I'm still arranging my components the wrong way, but some more code iteration will clue me in there).  But I'm still curious why the first way didn't work; I think there's some deep Seam knowledge in there somewhere...?
  | 

Its because all of your @Ins and @Outs are Seam managed components and PersistenceContext is not. Its dependency injection by the EJB Container for the EntityManager object into your Beans. If you had a Seam Component that wraps the EntityManager, then you could use the @In there to get the variable but since thats not the case, your object wasnt getting initialized. Refer to 
http://java.sun.com/javaee/5/docs/api/javax/persistence/PersistenceContext.html

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

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



More information about the jboss-user mailing list