title: Spring Data JPA - Writing a complex Query Method
body: <p>I'm using: Spring Data Repository + Hibernate</p>
  
  <p>I have a table: <code>Post</code>, with the field: <code>User userBoard</code> and <code>Date dateCreated</code></p>
  
  <p>I have a table: <code>User</code>, with the field: <code>List&lt;User&gt; friends</code></p>
  
  <p>To the question I have to specify the parameters:</p>
  
  <ul>
  <li><p>User <em>user</em></p></li>
  <li><p>Date <em>dateCreated</em></p></li>
  <li><p>Pageable <em>page</em> </p></li>
  </ul>
  
  <p>I would like to achieve:</p>
  
  <p>Download all posts by <em>user</em> + all posts by users on the list of user's friends for <em>user</em>, then posts are to have a date earlier than the date <em>dateCreated</em> sorting the collected items from the oldest date to all this, of course-pages <em>page</em></p>
  
  <p>I know that I can achieve this without the native query, so please advice on how to go about it. I can write a simple question, but the complex is no longer in the native query.
  Thanks for the help</p>