JPA inheritance query (Eclipse Link)
<p>Consider the following schema:</p>

<pre class="lang-java prettyprint-override"><code>public class A {
    @Id
    int id;
    String fieldA;
}
</code></pre>

<pre class="lang-java prettyprint-override"><code>public class B extends A {
    String fieldB;
}
</code></pre>

<pre class="lang-java prettyprint-override"><code>public class C extends A {
    String fieldC;
}
</code></pre>

<p>How can I query <code>A</code> in such a way to get <strong><em>all</em></strong> the <code>C</code>'s and get <strong><em>only</em></strong> the <code>B</code>'s where <code>fieldB="someValue"</code>?</p>

<p>I have tried to use <strong>treat</strong> in order to make downcast but it seems that the filter on <code>B</code> is working on all the parent class (<code>A</code>).</p>

<p>Is such query possible in the first place?</p>