[jboss-user] [EJB 3.0] - EntityManager inject in an EJB 2.1 Sesssion Bean

naguilar do-not-reply at jboss.com
Wed Nov 19 10:02:38 EST 2008


I have an application that uses EJB 2.1 stateless sessions beans and JDBC.  I would like to move the JDBC towards EJB 3 Entities so I won't have to manage the SQL, but because of time I cannot upgrade my sessions beans (so they must continue to follow the EJB 2.1 spec).  

I've successuflly written and tested the Entities using annotations and have it working properly outside of the container.  But when I try to run them within the container and have JBoss use dependency injection to set the EntityManager on my Session bean, it never works.  Basically, the EntityManager is never set and is left as null.

Please note that in order to make sure that my environment was setup correctly, I created a simple HelloWorld bean and entity using EJB 3 feautes and the dependency injection of my EntityManager works as expected.

Therefore, Is it possible to use dependency injection on an EJB 2.1 session bean or must everything be upgraded to EJB 3?  Can I mix EJB 2.1 and EJB 3.0 features?

Here is my environment information:
JDK 1.5.0_16
JBoss 4.2.3

Thanks in advance.

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

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



More information about the jboss-user mailing list