Two Laptop Bag*
The moose likes EJB and other Java EE Technologies and the fly likes @PersistenceContext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "@PersistenceContext" Watch "@PersistenceContext" New topic
Author

@PersistenceContext

M.W. Brown
Greenhorn

Joined: May 21, 2012
Posts: 1
We have a JAR file that contains DAO and DAOImpl classes. We have one
abstract BaseDAOImpl class that creates EntityManager instance
variables via @PersistenceContext.

When this JAR file gets packaged up in a WAR file with jersey services
and other code all is fine.


When this JAR file gets packaged into an EAR with an EJB jar file the
EntityManagers are always null.

I would imagine this isn't a completely unusual use case. Has anyone
run into / overcome this sort of thing? We happen to be using glassfish.

When the EAR is deployed we see hibernate find all of the persistence
units its just at runtime we can't get the EMs built.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: @PersistenceContext