Is there any way I can get a JPASubQuery
from a JPAQuery
and vice versa? I have a JPAQuery
and I want to reuse it as a subquery but seems like there's not any kind of common interface between the two so that I can perform this transition. The query is quite big and it gets anything but nice rewriting the entire thing as a sub query (actually duplicating the identical from
part). So I am looking for something like this:
JPAQuery query = new JPAQuery(entityManager);
query.from(e).leftJoin(and(or(c1,c2,c3),c4,c5)).where(and(c6,c7,c8));
JPASubQuery sub = query.toSubQuery();