title: JPA one-to-many filtering
body: <p>We are nesting several entities. However upon retrieving we only want to get those entities which are active.</p>
  
  <pre><code>@Entity
  public class System {
    @Id
    @Column(name = "ID")
    private Integer id;
  
    @OneToMany(mappedBy = "system")
    private Set&lt;Systemproperty&gt; systempropertys;
  }
  
  @Entity
  public class Systemproperty {
    @Id
    @Column(name = "ID")
    private Integer id;
  
    @Id
    @Column(name = "ACTIVE")
    private Integer active;
  }
  </code></pre>
  
  <p>When requesting the <code>Systemproperties</code> I only want to get the properties that are <code>active</code> (<em>active = 1</em>).</p>
  
  <p>Searching around I found some <a href="https://stackoverflow.com/a/6920847/1022141"><em>hibernate annotations</em></a> and the possibility to use <a href="https://stackoverflow.com/a/6564642/1022141">subqueries</a>. However both don't really work for me. Even though we are currently using hibernate I'm considering to replace it with Eclipselink, because we currently have to use eager loading and we are likely to run into performance problems with that. The subqueries don't really work well, because we are nesting several levels.</p>
  
  <p>Eclipselink seems to have a <a href="http://wiki.eclipse.org/Customizing_the_EclipseLink_Application_%28ELUG%29" rel="noreferrer"><em>@Customizer</em></a> annotation that could work, however it seems to follow a different concept then the hibernate <code>@FilterDef</code> annotation and would cause additional overhead when switching.</p>
  
  <p>The <code>@JoinColumn</code> doesn't seem to allow further filtering. Is there a standard JPA way to solve this problem?</p>