Hello,
I'm trying to setup a simple RESTful webservice by using jersey.
Additionally I'm using Glassfish 2 as server and hibernate for persistence.
In my JAX-RS resource I'm trying to get a EntityManagerFactory to create an
EntityManager by using:
@PersistenceContext(unitName="myPU")
EntityManagerFactory emf;
This is not working L emf is always null.
If I'm using
@GET
@Produces("text/plain")
public String getIt() {
EntityManagerFactory emf = Persistence.createEntityManagerFactory(
"myPU" );
it is working.
I would prefer to inject the emf by using the @PersistenceContext
annotation. Why it is not working?
Best regards,
ole