title: JPA/Hibernate: JPA Relationship, filter NULL values
body: <p>I've been looking around Google for a while without finding an answer.</p>
  
  <p>I have two tables: one is mine, the other is shared. Mapping to entities, I have this very generic situation:</p>
  
  <pre><code>Entity1 {
    @Id Long id;
    Long otherId;
    Entity2 other;
    ...
  }
  
  Entity2 {
   @Id Long id;
   Long otherId;
   Date invalidatingDate;
   ...
  }
  </code></pre>
  
  <p>Those two otherId are the same and should be joined but due to field invalidatingDate I get a OneToMany relationship that should be OneToOne. Is there any way to costrain the relation with a INVALIDATING_DATE IS NULL? Into Entity2, given an otherId, a WHERE INVALIDATING_DATE IS NULL will always give a single result.
  Is such a thing possible?</p>
  
  <p>Thank you.</p>