How to join to a JOINED subclass in a Hibernate / JPA 2.0 CriteriaQuery?
<p>I need to join from a superclass attribute to its subclass entity (using <a href="http://docs.oracle.com/javaee/5/api/javax/persistence/InheritanceType.html#JOINED" rel="nofollow noreferrer">JOINED</a> inheritance). Tried something like this:</p>

<pre><code>root.join(RootClass_.superClassAttribute).as(SubClass.class)
</code></pre>

<p>...and need to continue this by joining from the subclass to other entities.
But the <code>as</code> is returning a <code>CastFunction</code> so not sure how this is possible?</p>

<p>(Note: Am using JPA 2.0, not 2.1 so can't use <a href="http://docs.oracle.com/javaee/7/api/javax/persistence/criteria/CriteriaBuilder.html#treat-javax.persistence.criteria.Join-java.lang.Class-" rel="nofollow noreferrer"><code>treat</code></a>.)</p>