well I am not sure about it being a common problem. I am pasting the code which works for me..
try { //Get the data from user's form String id = (String) request.getParameter("id"); //create an em. //Since the em is created inside a transaction, it is associsated with //the transaction utx.begin(); em = emf.createEntityManager(); Person p=em.find(Person.class,id); if(p!=null) { em.remove(p); } utx.commit(); request.getRequestDispatcher("ListPerson").forward(request, response); } catch (Exception ex) { throw new ServletException(ex); } finally { //close the em to release any resources held up by the persistebce provider if(em != null) { em.close(); } } Hope it is of some help. akshay. On Jun 5, 2009 4:54pm, Biljana Biljana <biljana_b...@yahoo.com> wrote: > Hi Mark! > this problem occured to everyone if you searche in groupe mail list. They > said that we can't use remove() method, you must in delete servlet have > sql statement which will delete person in database that you want to > delete. > regards, > Biljana > --- On Fri, 6/5/09, aks.it...@gmail.com aks.it...@gmail.com> wrote: > From: aks.it...@gmail.com aks.it...@gmail.com> > Subject: [java ee programming] Re: Regarding JPA Basics Lab-HomeWork. > To: "mak pandian" kolluranipand...@gmail.com>, > java-ee-j2ee-programming-with-passion@googlegroups.com > Date: Friday, June 5, 2009, 7:28 AM > Hi mak, > It would be easier to help you,if you could paste the code where u have > the logic to delete the record. > akshay > On Jun 5, 2009 9:55am, mak pandian kolluranipand...@gmail.com> wrote: > > Hello , > > > > Now i am doing JPA Basics Home work.I done delete option for every > records in the table.My logic is described below. > > > > When the user click the delete option,The servlet DeleteServlet is > invoked. > > > > In delete servlet,I get id from request parameter. > > > > And then i did in the same way what was in the lab for insert record. > > > > But after that while building i dont get any error even warning. > > > > While running application i get errors like" remove() method could not > be used " > > > > > > > > How can i fix it? > > > > > > > > Does some one has different > logic to do?if so ,share it with me. > > > > > > > > Thanking You. > > > > > > -- > > Regards > > KolluraniPandian A > > (Living in Virtual World) > > > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---