The Problem = An instance of a null PK has been incorrectly provided for this 
find operation.

how can I fix it ????

public class DeletePersonServlet extends HttpServlet {
   
      @PersistenceUnit
    private EntityManagerFactory emf;

    @Resource
    private UserTransaction utx;

    protected void processRequest(HttpServletRequest request, 
HttpServletResponse response)
    throws ServletException, IOException
    {
       assert emf != null;
        EntityManager em = null;
        try {
      
            String id = (String) request.getParameter("id");

            utx.begin();

            em = emf.createEntityManager();
            Person person = em.find(Person.class, id);
            em.remove(person);

            utx.commit();

            request.getRequestDispatcher("ListPerson").forward(request, 
response);
        } catch (Exception ex) {
            throw new ServletException(ex);
        } finally {
           
            if(em != null) {
                em.close();
            }
        }
    }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Java 
EE (J2EE) Programming with Passion!" group.
To post to this group, send email to 
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to 
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to