Hibernate criteria API could handle this situation without the need to write HQL. Consider that A has a collection of B and you what to put criteria on b attributes then here is what we can do with criteria API:
Criteria criteria = getSession().createCriteria(A.class).setFetchMode("b", FetchMode.JOIN);
criteria.add(Restrictions.eq("b.attribute1",somthing);
I‘ve used it many time and it worked. You can deal with more complicated queries with this technique but be careful of performance in some situations.