[jboss-user] [Beginner's Corner] - Re: JBoss : persistence and EntityManager injection

zecas zecas do-not-reply at jboss.com
Thu Oct 14 06:04:45 EDT 2010


zecas zecas [http://community.jboss.org/people/zecas] created the discussion

"Re: JBoss : persistence and EntityManager injection"

To view the discussion, visit: http://community.jboss.org/message/566437#566437

--------------------------------------------------------------
> 
> Wolf-Dieter Fink wrote:
> 
> For me it is unclear how you call the method something.
> Injection is nothing magic, the container must have a chance to do it.

First of all, Thanks for the help.

I'm invoking the method in a servlet context listener defined in "web.xml".

During the listener execution, I do something like:

SimpleMessage sm = new SimpleMessage();
sm.something();



If I inject the EntityManagerFactory in the listener class, it is successfully instantiated and available (not NULL), but inside that class, I'm not getting it with a value other than NULL.

Since I'm invoking the class from within a listener, which is inside the container, I was hoping (and testing) to get it to work ... to avoid having to pass it to the underlying class I'm invoking, and that will do the work.

(Understanding this behaviour will help to clarify some doubts I'm having for some time.)


Thanks.
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/566437#566437]

Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101014/8e976d2d/attachment.html 


More information about the jboss-user mailing list