What is the JPA CriteriaBuilder way for filtering on Sub Classes?
Examples of common queries are here
Example:
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery cq = cb.createQuery();
Root e = cq.from(Entity.class);
cq.where(cb.equal(e.type(), entityType));
Query query = em.createQuery(cq);
List<Entity> result = query.getResultList();
You can use Path type method as documented here:
Predicate p = cb.equal(e.type(), cb.literal(Entity.class));