1. JPA Tutorial
http://www.java2s.com/Tutorials/Java/JPA/index.htm
2. Spring RestController doesn't set parameter for PUT request
FROM:
http://stackoverflow.com/questions/29017593/spring-4-restcontroller-not-receiving-data-from-put-request
This is a limitation of the
Servlet Spec and the inner workings of Spring for populating model attributes.
First, the spec says
3.1.1 When Parameters Are Available
The following are the conditions that must be met before post form data will be populated to the parameter set:
- The request is an HTTP or HTTPS request.
- The HTTP method is POST.
- The content type is application/x-www-form-urlencoded.
- The servlet has made an initial call of any of the
getParameter
family of methods on the request object. If the conditions are not met and the post form data is not included in the parameter set, the post data must still be available to the servlet via the request object's input stream. If the conditions are met, post form data will no longer be available for reading directly from the request object's input stream.
Since this is a PUT request, the parameters are not retrievable through getParameter
. However, they are still accessible through the request body, but Spring doesn't go there for model attributes.
You can do the conversion yourself. But I suggest you change your request content to JSON or XML for PUT and use @RequestBody
annotated parameters.