aspose 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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply 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: 482
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]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: JPA - inject of EntityManager is always null
 
Similar Threads
EntityManager is null when I try to use it straight from filter servlet
Exception got in deployment of EJB3 .ear
Passing EntityManager reference between methods doesn't work as expected
bytearray image decoding
Problem trying to create my EntityManagerFactory