This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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]
 
 
subject: JPA - inject of EntityManager is always null
 
Similar Threads
bytearray image decoding
EntityManager is null when I try to use it straight from filter servlet
Passing EntityManager reference between methods doesn't work as expected
Problem trying to create my EntityManagerFactory
Exception got in deployment of EJB3 .ear