Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your controller needs some modifications; I am assuming the client is POSTing something in this example:</p> <pre><code>@SuppressWarnings("unchecked") @RequestMapping(value = "/selectHarbour", method = POST) public ResponseEntity&lt;String&gt; createEntity(HttpServletRequest request, @RequestBody Specialist specialist) { specialistBo.save(specialist); final int id = specialist.getId(); URI uri = new UriTemplate("{requestUrl}/{username}").expand(request.getRequestURL().toString(), id); final HttpHeaders headers = new HttpHeaders(); headers.put("Location", singletonList(uri.toASCIIString())); return new ResponseEntity&lt;String&gt;(headers, HttpStatus.CREATED); } </code></pre> <p>If you want to GET something it should be similar to this:</p> <pre><code>@RequestMapping(method = GET) public @ResponseBody Page&lt;Specialist&gt; listEntities(@RequestParam(value = "page", required = false, defaultValue = "1") int page, @RequestParam(value = "max", required = false, defaultValue = "5") int max, @RequestParam(value = "sidx", required = false, defaultValue = "grid_name") String sidx, @RequestParam(value = "sord", required = false, defaultValue = "desc") String sord, @RequestParam(value = "filters", required = false, defaultValue = "") String filters) { return specialistBo.getSpecialist(page, max, stringStringMap.get(sidx), sord, filters); } </code></pre> <hr> <pre><code> @Transactional(readOnly = true) public Page&lt;Specialist&gt; getSpecialist(int page, int max, String sidx, String sord, String filters) { int count = ((Long) getSession().createQuery("select count(*) from Specialist").iterate().next()).intValue(); final int start = max * page - max; @SuppressWarnings("unchecked") List&lt;Specialist&gt; list = getSession().createCriteria(Specialist.class) .add(Restrictions.sqlRestriction("name like '%%' order by %s %s limit %s,%s")).setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list(); return new Page&lt;Specialist&gt;(list, page, max, count); } </code></pre> <hr> <pre><code>@XmlRootElement @XmlSeeAlso({Specialist.class, Aptitude.class}) public class Page&lt;T&gt; { private List&lt;T&gt; rows; private int page; private int max; private int total; </code></pre> <p>You will need to create getters and setters for Page. Hope this helps a bit</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload