title: Spring Jpa Data , Pageable , Pagerequest
body: <p>I am using Spring JPA DATA in my project. I wanna make my data pageble. I have already add Pageable to my repository method. But it shows error something like that:</p>
  
  <blockquote>
    <p>Request processing failed; nested exception is
    java.lang.IllegalArgumentException: You have to provide at least one
    property to sort by! java.lang.IllegalArgumentException: You have to
    provide at least one property to sort by!
          org.springframework.data.domain.Sort.&lt;init&gt;(Sort.java:92)
          org.springframework.data.domain.Sort.&lt;init&gt;(Sort.java:80)
          org.springframework.data.domain.PageRequest.&lt;init&gt;(PageRequest.java:52)
          com.datum.fnd.controller.rest.NodeRestController.getNodes(NodeRestController.java:44)
          sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method).....</p>
  </blockquote>
  
  <p>I want to share my codes with you. Please look over following codes. I haven't find where I did mistake </p>
  
  <p><strong>My @Repository class:</strong></p>
  
  <pre><code>@Query(value = "select new com.datum.fnd.domain.Node(c.idNode, c.name,c.address, c.description, c.point) from Node c")
  List&lt;Node&gt; getNodesByPage(Pageable pageable);
  </code></pre>
  
  <p><strong>My Service class:</strong></p>
  
  <pre><code>public interface NodeService extends DefaultService&lt;Node, Long&gt; {
      List&lt;Node&gt; getUnboundedNodes();
  
      List&lt;Node&gt; getNodes(Pageable pageable);
  }
  </code></pre>
  
  <p><strong>My ServiceImpl class:</strong></p>
  
  <pre><code>@Service
  public class NodeServiceImpl implements NodeService {
  
  private static final Logger LOG = Logger.getLogger(NodeServiceImpl.class);
  
  @Autowired
  private NodeRepository nodeRepository;
  
  @Autowired
  private ChannelNodeRepository channelNodeRepository;
  
  @Override
  public Node create(Node node) {
      return nodeRepository.save(node);
  }
  
  
  @Transactional(readOnly = true)
  @Override
  public List&lt;Node&gt; list() {
      return nodeRepository.selectAll();
  }
  
  @Transactional(readOnly = true)
  @Override
  public List&lt;Node&gt; getNodes(Pageable pageable) {
      return nodeRepository.getNodesByPage(pageable);
  }
  </code></pre>
  
  <p><strong>My Controller class:</strong></p>
  
  <pre><code>@RequestMapping(value = "/page/{last_item}", method = RequestMethod.GET)
  public List&lt;Node&gt; getNodes(@PathVariable(value = "last_item") int last_item) {
      LOG.info("Retrieve all nodes");
  
      PageRequest page_req = new PageRequest(0, last_item, Direction.DESC);
      return nodeService.getNodes(page_req);
  }
  </code></pre>
  
  <p>And when I try to call "<a href="http://localhost:8088/FNDWEB/rest/node/page/50" rel="noreferrer">http://localhost:8088/FNDWEB/rest/node/page/50</a>" it shows the above-mentioned error.</p>