It seems pretty clear to me that createAlias() is designed to FORCE an "inner join". See:
The question I have (echoed in the above threads) is "why?"
My case is ideally suited to Criteria queries... I've got a complex entity that can be queried in dozens of different ways. I've got a class that specifies the query components and I can process them into a quite elegant Criteria query doing stuff like:
Code:
if (queryPart != null) {
crit.add(Restrictions.eq("somePart1", "test"));
}
if (queryPart2 != null) {
Junction j = Restrictions.conjunction();
j.add(Restrictions.ge("somePart2", queryPart2.getValMin()));
j.add(Restrictions.le("somePart2", queryPart2.getValMax()));
crit.add(j);
}
...
and on and on... However, this doesn't work if it inner joins when I add an alias (to query on attributes of my children).
I know I can do this in HQL, but it seems much more messy because I have to build up an HQL string, and then setParameter() appropriately, etc.
So... What should I do?
Thanks,
Andy