0

I am using the Jax-Rs and JPA implementing REST Webservice,I wanna delete the resource with @DELETE,this is my code

@DELETE
@Path("/list/{id}")
public void delete(@PathParam("id") String id) {


    Query query = helper.getEntityManager().createQuery("Delete from CtmOrderEntity c where c.id=?1");
    query.setParameter(1, id);
    Object result = query.getSingleResult();
    int update = query.executeUpdate();

    System.out.println("Delete resutl" + result);
    System.out.println("Delete signal" + update);
}

Then the console prints the error:

No resource method found for GET, return 405 with Allow header

I could not resolve the problem,Does anyone have any ideas with me?Thx.

JoeXu
  • 41
  • 1
  • 8
  • `@DELETE` means only accept DELETE method for given URL. So your webpage should do DELETE instead of GET [https://stackoverflow.com/a/2153931/3710490](https://stackoverflow.com/a/2153931/3710490) – Valijon Jul 22 '17 at 11:48
  • Thanks very much,I ignored this question,maybe this was the price with me using REST firstly – JoeXu Jul 22 '17 at 12:52

0 Answers0