title: Searching entity by another entity as criteria
body: <p>I'm havin simple relationship between entities: </p>
  
  <pre><code>class Product {
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private long id;
      private String name;
      private double calories;
  
      @ManyToOne(fetch = FetchType.EAGER)
      @JoinColumn
      private Category category;
  }
  
  class Category {
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private Long id;
  
      @Column(unique = true)
      private String name;
  
      Category(String name) {
          this.name = name;
      }
  }
  </code></pre>
  
  <p>And I'm using following repository </p>
  
  <pre><code>interface ProductRepository extends Repository&lt;Product, Long&gt; {
      Product save(Product product);
      Page&lt;Product&gt; findAll(Pageable pageable);
      Page&lt;Product&gt; findByCategory(Pageable pageable, Category category);
      void delete(Product product);
  }
  </code></pre>
  
  <p>Which is invoked in <code>facade</code> like this</p>
  
  <pre><code> public Page&lt;ProductDTO&gt; getProductsByCategory(Pageable pageable, String categoryName) {
          return productRepository.findByCategory(pageable, dtoConverter.toCategory(categoryName))
                  .map(Product::toDTO);
      }
  </code></pre>
  
  <p>and in <code>dtoConverter</code></p>
  
  <pre><code>Category toCategory(String categoryName) {
          return new Category(categoryName);
      }
  </code></pre>
  
  <p>Which finnaly leads us to <code>Controller</code></p>
  
  <pre><code>@GetMapping("/findCategory")
      Page&lt;ProductDTO&gt; getProductsByCategory(Pageable pageable, @RequestParam String categoryName) {
          return productFacade.getProductsByCategory(pageable, categoryName);
      }
  </code></pre>
  
  <p>I'v got very similar way to get and create new products, it works, but once I try to find product by category the way I described above, I got </p>
  
  <pre><code>{
      "timestamp": "2018-11-30T22:57:29.660+0000",
      "status": 404,
      "error": "Not Found",
      "message": "No message available",
      "path": "/products/findCategory=fruit"
  }
  </code></pre>
  
  <p>Even tho I'm sure there are Products of this category stored in db (I find them looking directly at mysql and by using findAll endpoint). Anyone can explain me what is wrong here?</p>