title: Apply filter on linking table in Hibernate
body: <p><a href="https://i.stack.imgur.com/pTAGI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pTAGI.png" alt="enter image description here"></a></p>
  
  <p>I've got a classic case of Category &lt;-> Category_Product &lt;-> Product relation.
  CategoryDTO class has <code>Set&lt;ProductDTO&gt;</code> member that defined as:</p>
  
  <pre><code>@ManyToMany(cascade = CascadeType.ALL)
  @JoinTable(
          name = "Category_Product",
          joinColumns = @JoinColumn(name = "CAT_ID"),
          inverseJoinColumns = @JoinColumn(name = "PROD_ID")
  )
  public Set&lt;Product&gt; getProducts() {
      return products;
  }
  </code></pre>
  
  <p>The problem is that I want to have Category->Product relation if and only if the  <strong>Category_Product.ENABLED is '1'</strong>.
  I tried to use <code>@FilterJoinTable</code> annotation but, as I understand, it works on entities only (not on linking table), so it doesn't help here.
  I hope that there is an elegant solution that uses Hibernate built-in features.</p>