title: Hibernate @Where annotation on a ManyToOne relation
body: <p>I have recently started to refactor my project because I had to add an extra column to some of my table. The extra column is an Enum (Pending, or Active). 
  Because of that change I would need now to refactor ALL my queries to only retrieves a row if the status is ACTIVE.</p>
  
  <p>After some research I found that we can annotate an Entity with the @Where annotation. it works fine where I use it on a simple column but my table look like this:</p>
  
  <pre><code>@Where(clause = 'state='ACTIVE'")
  @Entity
  public class Place {
  
    @Column(name="id_place")
    private String placeId;
  
    @Column(name="name")
    private String palceName;
  
  @OneToMany(mappedBy = "place")
      private Set&lt;PlaceTag&gt; placeTag;
  
    ...
    ...
  }
  
  @Where(clause = 'state='ACTIVE'")
  @Entity
  public class Tag {
  
    @Column(name="id_tag")
    private String tagId;
  
    @Column(name="name")
    private String tagName;
  
     @OneToMany(mappedBy = "tag")
      private Set&lt;PlaceTag&gt; placeTag;
     ... 
     ...
  }
  
  @Where(clause = 'poi.state='ACTIVE' AND tag.state='ACTIVE")
  @Entity
  public class PlaceTag {
  
    @Column(name="id")
    private String id;
  
    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name = "place_id")
    private Place place;
  
    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name = "tag_id")
    private Tag tag;
  
    ...
    ...
  
  }
  </code></pre>
  
  <p>Now my question would be how can make this statement ONLY return the places and tags that are ACTIVE ?</p>
  
  <pre><code>SELECT pt FROM PlaceTag pt;
  </code></pre>
  
  <p>Is this possible? Or will I have to write the query Explicitly ?</p>
  
  <p>Thank you </p>