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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring 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]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPA - inject of EntityManager is always null