The legacy Hibernate Criteria is deprecated and might be removed in a future release.
You should use the JPA Criteria API instead, and you can achieve your goal like this:
CriteriaQuery<B> q = cb.createQuery(B.class);
Root<B> root = q.from(B.class);
q.select(root)
.where(cb.notEqual(root.type(), B.class));