title: Query DSL advance sorting with spring pageable
body: <p>) I have some problem with sorting and spring pageable when I use QueryDSL. I need quite advanced sorting, not just by the fields of the object stored in the database in the same table.</p>
  
  <p>This is my model in approx:</p>
  
  <pre><code>@Getter
  @Setter
  @Entity
  public class Book {
  
    @Id
    @GeneratedValue
    private long id;
  
    @OneToMany
    private Set&lt;Category&gt; cats = new HashSet&lt;&gt;()
  
    } 
  
   @Getter
   @Setter
   @Entity
    public class Category{
      private long id;
      private Name name;
    }
  
   public enum Name{
    WINTER,
    SUN,
    SUMMER
   }
  </code></pre>
  
  <p>Now, this what I want to do is sort (desc and asc) Book (I have many Books) by Category id only if Category has name SUN. And i want to pass Qsort as Sort interface to PageRequest sping class. </p>
  
  <p>I have no idea how I can achieve it. I try many way but none of these are even close to resolve this problem (for example some subquery with invoke any() on collection and use Qsort class). I affraid I made a mistake using Query DSL rather than Criteria Api. Can someone direct me? I will be very grateful.</p>
  
  <p>Best Regards </p>