File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes JPA - inject of EntityManager is always null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JPA - inject of EntityManager is always null " Watch "JPA - inject of EntityManager is always null " New topic
Author

JPA - inject of EntityManager is always null

zshal shlev
Greenhorn

Joined: Jun 17, 2009
Posts: 1
hi all
serious beginner problem
i have an ejb3 in jboss 5.1
see code:

@Stateless(mappedName = "iknowbean")
public class IknowBean implements IknowBeanLocal {

@PersistenceContext (unitName="INOPro") private EntityManager emf;

in the persistence.xml i have the unitName appearing as the persistence-unit

why is emf always null

when i run it from servlet it works when i run it from this ejb it does not

any help would be great
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Hai...

May i know your persistence.xml configuration?...
and where do you put that persistence.xml file?..

Thanks ...


Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JPA - inject of EntityManager is always null
 
Similar Threads
Problem trying to create my EntityManagerFactory
Passing EntityManager reference between methods doesn't work as expected
Exception got in deployment of EJB3 .ear
bytearray image decoding
EntityManager is null when I try to use it straight from filter servlet