Uploaded image for project: 'Thorntail'
  1. Thorntail
  2. THORN-48

Injecting PersistenceContext in JAX-RS resource does not work

    Details

    • Type: Story
    • Status: Closed (View Workflow)
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 1.0.0.Alpha6
    • Component/s: None
    • Labels:
      None

      Description

      The following code:

      @Path("/resource")
      public class MyResource {
          
          @PersistenceContext
          EntityManager em;
              
          @GET
          public List<Employee> getAll() {
              return em.createNamedQuery("Employee.findAll", Employee.class).getResultList();
          }
      }
      

      returns null for em in getAll method.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                ArunGupta Arun Gupta
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: