Can I inject an EntityManager in an EntityBean in EJB 3.0?
I use JAG (Java Application Generator: http://jag.sourceforge.net/) to generate my application from an existent DB.
In the generated Entity Bean I found something like:
@Inject EntityManager manager;
after I changed @Inject with @PersistenceContext I was able to
compile and deploy the Beans on JBoss 4.0.2 and EJB3.0 rc2,
but in the debugger I noticed that the field manager is always
null in EntityBeans.
THANK YOU
Gianfranco
Entity Beans are not injected. Plus injection an EM in an Entity is clearly considered evil practice. You link your persistence mechanism with your domain model